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

Paths are truncated to early when pathconf is available #26

Open
Flamefire opened this issue Apr 8, 2024 · 0 comments
Open

Paths are truncated to early when pathconf is available #26

Flamefire opened this issue Apr 8, 2024 · 0 comments

Comments

@Flamefire
Copy link

Flamefire commented Apr 8, 2024

I'm doing a wget --mirror operation on a fairly long URL (including the host folder ~ 242 chars) into another folder via --outdir adding another couple of chars.

This runs into the length limitation at

wget/src/url.c

Line 1523 in 9a35fe6

if (max_length > 0 && outlen > max_length)

However I think that limitation is to aggressive/sensitive: It takes the entire quoted path (i.e. at least the 242 chars) and compares it against pathconf(..., _PC_NAME_MAX) when that is available. See

wget/src/utils.c

Lines 2665 to 2671 in 9a35fe6

#if HAVE_PATHCONF
ret = pathconf (*p ? p : ".", name);
if (!(ret < 0 && errno == ENOENT))
break;
#else
ret = PATH_MAX;
#endif

Note that the _PC_NAME_MAX returns the maximum length for a filename while PATH_MAX is the maximum length of a path. The former is 255 while the latter is 4096 on "usual" Linux systems. So the 2 code paths are not nearly identical!

Given that the "chomp buffer" size (19) is additionally subtracted any output path is truncated at 255-19=236 chars which isn't enough for use-cases such as mine mirroring a larger hierarchy of folders (files in depth of 10 folders)

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

1 participant