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

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

Closed
boweeb opened this issue Mar 16, 2023 · 4 comments
Closed

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

boweeb opened this issue Mar 16, 2023 · 4 comments

Comments

@boweeb
Copy link

boweeb commented Mar 16, 2023

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:

stow/bin/stow.in

Lines 476 to 477 in 4ef5eca

my $stow = new Stow(%$options);
# current dir is now the target directory

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 #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.

@aspiers
Copy link
Owner

aspiers commented Mar 18, 2023

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:

stow/bin/stow.in

Lines 476 to 477 in 4ef5eca

my $stow = new Stow(%$options);
# current dir is now the target directory

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
Copy link

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
Copy link
Author

boweeb commented Jan 8, 2024

@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 aspiers closed this as completed in cbc12d7 Apr 7, 2024
@aspiers
Copy link
Owner

aspiers commented Apr 7, 2024

@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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants