aspiers / stow

GNU Stow - mirror of savannah git repository occasionally with more bleeding-edge branches
http://www.gnu.org/s/stow/
GNU General Public License v3.0
589 stars 41 forks source link

What changes cwd to the target directory during init of Stow? #102

Closed boweeb closed 3 months ago

boweeb commented 1 year ago

I have a what's perhaps a Perl noob question. bin/stow.in notes (in a comment) after initializing Stow that "current dir is now the target directory".

See: https://github.com/aspiers/stow/blob/4ef5eca4a9d107b24e712bb4c2c91f47e7e0fb85/bin/stow.in#L476-L477

Question: I'm having trouble finding the mechanism that is actually responsible for this. Can someone provide a hint?


For somewhat relevant context, I'm in the process of porting stow to Python. Since this is for personal recreation (yes, I'm a nerd), I don't feel bound to backward compatibility or practical production constraints (eg. avoiding 3rd party libs); however, with https://github.com/aspiers/stow/issues/65#issuecomment-1434600782 in mind, I will freely make it available in case @aspiers or the community finds it a useful reference. I'm about 1/2 done already (started this week), but I'm currently hung up on this question I asked above.

aspiers commented 1 year ago

I have a what's perhaps a Perl noob question. bin/stow.in notes (in a comment) after initializing Stow that "current dir is now the target directory".

See:

https://github.com/aspiers/stow/blob/4ef5eca4a9d107b24e712bb4c2c91f47e7e0fb85/bin/stow.in#L476-L477

Question: I'm having trouble finding the mechanism that is actually responsible for this. Can someone provide a hint?

Hmm. At a quick glance I can't see any chdir() call which happens before this point, and this comment is extremely old, so it's probably an erroneous remnant of some refactoring. I'd suggest ignoring it for now.

For somewhat relevant context, I'm in the process of porting stow to Python.

Awesome!

Since this is for personal recreation (yes, I'm a nerd), I don't feel bound to backward compatibility or practical production constraints (eg. avoiding 3rd party libs); however, with #65 (comment) in mind, I will freely make it available in case @aspiers or the community finds it a useful reference.

Please do! If you are able to convert the existing Perl test suite over too then that would give us a ton of confidence that the Python implementation achieves equivalent behaviour.

I'm about 1/2 done already (started this week), but I'm currently hung up on this question I asked above.

OK cool, please keep us posted!

cavcrosby commented 6 months ago

Since this is for personal recreation (yes, I'm a nerd), I don't feel bound to backward compatibility or practical production constraints (eg. avoiding 3rd party libs); however, with #65 (comment) in mind, I will freely make it available in case @aspiers or the community finds it a useful reference. I'm about 1/2 done already (started this week), but I'm currently hung up on this question I asked above.

It's coming about to a year since you've mentioned this @boweeb, did you happen to make any further progress?

boweeb commented 6 months ago

@cavcrosby -- Thanks for the reminder! As often happens with personal side projects (at least with me), life got the way, and I lost track. This poke has rekindled my interest. I'll see what I can do to clean up and push what I have soon. It may not be functional yet, but it's better to share something than nothing.

Also, I'm embarrassed to realize I left this issue dangling. I'll confirm what I did about it and either move this forward or close it out.

aspiers commented 3 months ago

@boweeb Now that the cobwebs are blown out of my head regarding how Stow works, I can confidently say that this was simply an outdated comment. I've now removed it.

Please keep us posted on any Python rewrite. I think it's a super interesting initiative! Realistically Perl is getting closer and closer to extinction these days (although like COBOL I'm sure it will never die).