This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: getpath.c-generated prefix wrong for Tru64 scripts
Type: behavior Stage: resolved
Components: Interpreter Core Versions:
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: ajaksu2, loewis, mkc
Priority: low Keywords:

Created on 2003-04-25 19:57 by mkc, last changed 2022-04-10 16:08 by admin. This issue is now closed.

Messages (6)
msg60324 - (view) Author: Mike Coleman (mkc) Date: 2003-04-25 19:57
Under Tru64 (version 5.1a, and probably others), when a
Python script is structured like so:

    #!/something/bin/python
    import sys
    print sys.prefix

the calculation of prefix in getpath.c won't work
correctly.  The reason is that argv[0] will be 'python'
rather than '/something/bin/python' (as it would be
under, say, Linux).

The code happens to work correctly in some simple
scenarios, but fails in a pretty mysterious way if one
has a different python in one's PATH than the one in
the #! line.  So, for example, if my PATH=/usr/bin and
there is a /usr/bin/python, then if I run the script
above, sys.prefix will be set to '/usr' instead of
'/something' and the wrong module path will be set up, etc.

It would be much better to simply obey the compiled
PREFIX instead, at least in the case where argv[0] has
no slashes.
msg60325 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2003-05-04 12:43
Logged In: YES 
user_id=21627

Is there any way for a binary to find out its location on
disk, on Tru64?
msg60326 - (view) Author: Mike Coleman (mkc) Date: 2003-05-07 18:29
Logged In: YES 
user_id=555

I hunted around in the man pages and googled and I couldn't
find much.  There is a proc ioctl PIOCOPENM (see
http://www.advogato.org/person/jum/diary.html?start=34)
which will give you an fd to the executable, but I don't
know of any way to map that back to a filename.
msg81715 - (view) Author: Daniel Diniz (ajaksu2) * (Python triager) Date: 2009-02-12 03:20
We'd need confirmation, preferably with assistance from a Tru64 guru.
msg81720 - (view) Author: Mike Coleman (mkc) Date: 2009-02-12 04:14
I'll go down to the cemetery and see if I can dig one up.  :-)

All of our Tru64 machines have been powered-down for over three years
now, so as far as I'm concerned you can mark this one as no longer relevant.
msg81886 - (view) Author: Daniel Diniz (ajaksu2) * (Python triager) Date: 2009-02-13 06:58
Mike,
Thanks for the feedback (and laugh!). I'll close this one soon, unless
someone requests to keep open.
History
Date User Action Args
2022-04-10 16:08:20adminsetgithub: 38368
2009-02-20 01:54:08ajaksu2setstatus: pending -> closed
resolution: out of date
stage: test needed -> resolved
2009-02-18 01:51:49ajaksu2setstatus: open -> pending
priority: normal -> low
2009-02-13 06:58:02ajaksu2setmessages: + msg81886
2009-02-12 04:14:41mkcsetmessages: + msg81720
2009-02-12 03:20:07ajaksu2setnosy: + ajaksu2
type: behavior
messages: + msg81715
stage: test needed
2003-04-25 19:57:06mkccreate