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

Unuseful warnings with --xattr/--remote-time + --output /dev/null #6533

Closed
vszakats opened this issue Jan 26, 2021 · 3 comments
Closed

Unuseful warnings with --xattr/--remote-time + --output /dev/null #6533

vszakats opened this issue Jan 26, 2021 · 3 comments
Assignees
Labels

Comments

@vszakats
Copy link
Member

@vszakats vszakats commented Jan 26, 2021

When using the pattern curl <URL> --output /dev/null (typically in conjunction with --write-out '%{<format>}' to read the <format> value without actually retrieving the URL content), while having --xattr and/or --remote-time options enabled (e.g. via .curlrc or a curl alias), the warnings below may (remote time only when the server returns a Last-Modified: header) appear on stderr, respectively:

Warning: Error setting extended attributes: Operation not permitted
Failed to set filetime <unixtime> on outfile: Operation not permitted

Example (for *nix platforms):

$ curl --xattr --remote-time --output /dev/null https://example.org/ --write-out '%{content_type}'`

Actual console output:

Warning: Error setting extended attributes: Operation not permitted
Failed to set filetime <unixtime> on outfile: Operation not permitted
text/html; charset=UTF-8

Expected console output:

text/html; charset=UTF-8

An inconvenience rather than a bug per se, yet I think it'd be an improvement to try mitigating this, either by suppressing the warning when a non-file output is used, or by bringing --remote-time behavior closer to --xattr and omit the warning if the --silent option is used.

@bagder bagder added the cmdline tool label Jan 26, 2021
@bagder bagder self-assigned this Jan 26, 2021
@bagder
Copy link
Member

@bagder bagder commented Jan 26, 2021

This is file output for all curl knows...

bagder added a commit that referenced this issue Jan 26, 2021
For setting and getting time of the download. To make the outputs
respect --silent etc.

Reported-by: Viktor Szakats
Fixes #6533
@vszakats
Copy link
Member Author

@vszakats vszakats commented Jan 26, 2021

Indeed, that's the difficult part. This specific value can be hard-coded (which is rather unelegant), but I was wondering if there is a better (and possibly platform-agnostic) option.

Many thanks for your quick PR, and if I read it correctly, this will also silence it like it is done with --xattr, which I think should resolve this nicely. Definitely LGTM.

@bagder
Copy link
Member

@bagder bagder commented Jan 26, 2021

Yes, the PR will make the time-setting error message truly respect --silent as well, which of course was a bug to begin with.

@bagder bagder closed this in 71acece Jan 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants