the-xkcd-community / the-red-spider-project

Coding and xkcd combined, for fun!
http://the-xkcd-community.github.com/the-red-spider-project
Other
40 stars 33 forks source link

should setup.py do chmod +x on the scripts in /bin? [was: fortune is already taken on some unixy systems!] #52

Closed WesleyAC closed 11 years ago

WesleyAC commented 11 years ago

I was testing all of the commands, and found that fortune on my system runs /bin/fortune as opposed to RED_SPIDER_ROOT/bin/fortune.

Sadly, the only way to fix this would be to rename fortune to something else. Perhaps xkcd-fortune?

Is it worth the rename to fix this for the (probably small) number of users who have fortune installed?

lramati commented 11 years ago

We could also consider "overwriting" it for the duration of shell usage by having RED_SPIDER_ROOT/bin/ come before /bin/ in rsshell's PATH variable (I think) but I'm not sure how to do this

jgonggrijp commented 11 years ago

Actually $RED_SPIDER_ROOT/bin is already prepended to PATH, so if you're running fortune from within rsshell you should get the RSP version. :-)

Could you check that, @WesleyAC?

WesleyAC commented 11 years ago

@jgonggrijp, nope. Running fortune from rsshell gets me the unix version.

lramati commented 11 years ago

What if we take this as an opportunity to have the shell be a little more intelligent? I suggest the following changes:

jgonggrijp commented 11 years ago

@WesleyAC what if you first do chmod +x $RED_SPIDER_ROOT/bin/fortune?

WesleyAC commented 11 years ago

@jgonggrijp It works if I chmod +x first. Should setup.py chmod +x $RED_SPIDER_ROOT/bin/* by default?

jgonggrijp commented 11 years ago

Perhaps. So far setup.py was just assuming that the executable_scripts in /bin already had the execution bit set and so far fortune seems to have been the only (stubborn) exception. I just put it back again on the master branch. But perhaps it's unreasonable to make this assumption and then yes, setup.py should do it (on unixy systems).

Do you think the assumption that executable_scripts have the execution bit set is reasonable?

lramati commented 11 years ago

I'm going to go with no, because it will get messy with copies to and from flashdrives and other such media and between OSes. Better to have the setup assume nothing. If it resets the bit nothing bad happens. If it forgets to set the bit then ugly

WesleyAC commented 11 years ago

I agree with @firerogue, it's better to set it twice than not all.

jgonggrijp commented 11 years ago

Done. Python's os.chmod is a bit cumbersome because it doesn't let you just update one bit (you have (re)set all of them) so setup.py will only touch the permissions if a script in /bin is not executable.