[Piglit] [PATCH] core: don't try to resolve the real path of the file

Ken Phillis Jr kphillisjr at gmail.com
Tue Feb 25 16:55:45 PST 2014


On Mon, Feb 10, 2014 at 11:34 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> To elaborate a bit on why I think I'm right, let me provide this example:
>
> $ mkdir somepath
> $ cat > somepath/script.py
> import sys
> print open(sys.argv[1], "r").read()
> $ cat > testfile
> testing
> $ python somepath/script.py testfile
> testing
>
> Note that being able to read/write the "somepath" dir had absolute no
> effect on anything. open() works relative to the cwd. (And so does
> realpath, for that matter.)
>
>   -ilia

This is not exactly as easy to give a solid example but in my case I
generally use a system installed version of python scripts, so the
order of commands would be...

$ cat > /usr/bin/my-script.py
#!/usr/bin/env python
import sys
print open(sys.argv[1], "r").read()
$chmod 755 /usr/bin/my-script.py
$ cat > testfile
testing
$ my-script.py testfile
testing


More information about the Piglit mailing list