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

Fix handling filenames with trailing whitespace, update test #40

Merged
merged 2 commits into from Jul 3, 2023

Conversation

h3xx
Copy link
Contributor

@h3xx h3xx commented Jul 2, 2023

This stems from a (bug? feature?) in IO::File which allows complex file handle modes and stuff to be indicated in the filename, e.g. '>file.txt' or '| cat file.txt'. Specifying the file open mode disables this parsing.

This also fixes the issue where attempting to add files using Archive::Tar (via add_files()) with trailing whitespace would fail with Unable to add file: 'foo ' at ./myscript.pl line 24..

Closes #10 (GitHub)
Closes https://rt.cpan.org/Public/Bug/Display.html?id=103279

h3xx added 2 commits July 2, 2023 10:14
The existing test didn't test the underlying issue which MUST be
reproduced using add_files(), not add_data().
@h3xx h3xx changed the title Fix handling filenames with trailing whitespace Fix handling filenames with trailing whitespace, update test Jul 2, 2023
@bingos bingos merged commit 9ecd778 into jib:master Jul 3, 2023
15 of 16 checks passed
@h3xx h3xx deleted the fix-filename-whitespace branch July 3, 2023 21:57
@h3xx
Copy link
Contributor Author

h3xx commented Jul 13, 2023

I'll submit another PR to fix the Windows test.

I'm having a hard time repro-ing it using the version of Perl that ships with Git for Windows ("This is perl 5, version 34, subversion 0 (v5.34.0) built for x86_64-msys-thread-multi"). In this version everything works fine in the test as-written.

I've noticed some funny bugs in Windows systems regarding whitespace; if you create a file programmatically with a trailing space, Windows Explorer will not be able to delete the file or move it, saying "item not found." The file properties dialog will pull up with all the timestamps blank and the Security tab with an error message. File names with leading whitespace work as-expected.

tl;dr Windows is mildly allergic to filenames with trailing spaces.

@h3xx h3xx mentioned this pull request Sep 10, 2023
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

Successfully merging this pull request may close these issues.

RT #103279 - Archive::Tar strips trailing whitespace from extracted file names
2 participants