Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iswritable(::FileName) is useless and broken #7385

Closed
gasagna opened this issue Jun 23, 2014 · 9 comments
Closed

iswritable(::FileName) is useless and broken #7385

gasagna opened this issue Jun 23, 2014 · 9 comments
Labels
bug Indicates an unexpected problem or unintended behavior
Milestone

Comments

@gasagna
Copy link
Contributor

gasagna commented Jun 23, 2014

There is probably a bug is the iswritable function. Watch this:

julia> iswritable("/")
true

shell> touch /new
touch: cannot touch '/new': Permission denied

All this is run from the REPL, with julia launched as normal user, so there is no write permission at all in the root folder /. I would expect iswritable to return false in this case.

Running Julia v"0.3.0-prerelease+3461" on Ubuntu 14.04.

@ivarne
Copy link
Member

ivarne commented Jun 23, 2014

See also previous discussion on julia-users
https://groups.google.com/forum/#!topic/julia-users/V4sc2jyzDAQ

@gasagna
Copy link
Contributor Author

gasagna commented Jun 23, 2014

@ivarne I opened that discussion and reported the issue here. Thanks for the cross-reference.

@JeffBezanson
Copy link
Member

The documentation seems to be wrong. It says this refers to the current user, but it actually refers to any user.
Is there a way to test permissions against the current user without doing all the uid and group manipulation manually?

@ihnorton ihnorton added the bug label Jun 26, 2014
ihnorton added a commit to ihnorton/julia that referenced this issue Jun 26, 2014
This does not fully work on Windows, but is no worse than the current situation
ihnorton added a commit to ihnorton/julia that referenced this issue Jun 26, 2014
This does not fully work on Windows, but is no worse than the current situation
ihnorton added a commit that referenced this issue Jun 28, 2014
@ihnorton
Copy link
Member

fixed in a487dcf

ihnorton added a commit to ihnorton/julia that referenced this issue Jun 28, 2014
This does not fully work on Windows (no support for ACLs), but is no worse than the current situation
@timholy
Copy link
Member

timholy commented Jun 28, 2014

Nice, @ihnorton!

ihnorton added a commit that referenced this issue Jul 2, 2014
@ihnorton
Copy link
Member

ihnorton commented Jul 2, 2014

I guess we'll have to do it the bit-fiddly way then.

@ihnorton ihnorton reopened this Jul 2, 2014
@JeffBezanson
Copy link
Member

I don't get it --- is this another one of those unix things that just inexplicably doesn't work?

@rickhg12hs
Copy link
Contributor

Ref: #7563
This also needs to be fixed for isreadable and isexecutable.

@vtjnash vtjnash added this to the 0.4 milestone Dec 21, 2014
@vtjnash vtjnash changed the title bug in iswritable function iswritable(::FileName) is useless and broken Dec 21, 2014
@vtjnash
Copy link
Member

vtjnash commented Aug 22, 2015

PR was #7418 for Isiah's attempt (since github only seems to have linked the commit sha1 from here)

I think we should just delete this functions. Since, as the man page says: "Warning: Using access() to check if a user is authorized to, for example, open a file before actually doing so using open(2) creates a security hole, because the user might exploit the short time interval between checking and opening the file to manipulate it"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

7 participants