Add ar --output

Fangrui Song i@maskray.me
Tue Nov 5 17:33:00 GMT 2019
On 2019-11-05, Nick Clifton wrote:
>Hi Fangrui,
>
>> I think the is_valid_archive_path check should be placed before `if (output_dir)`.
>
>OK, I can do that.  One more question though...
>
>> printf '!<arch>\n%-48s%-10d`\n../file\n%-48s%-10s`\n' '//' 8 '/0' 0 > test.a
>> ar --output=/tmp/c x test.a => extracted ../file to /tmp/c, i.e.  /tmp/file
>
>With this example, if you add the "v" (verbose) option to the ar command line you
>get:
>
>  x - ../file
>
>As the output.  Do you think that if --output is used then the final output file
>name should be displayed.  IE:
>
>  x - /tmp/c/file
>
>Or in fact to be strict the output would actually be:
>
>  ar: illegal output pathname for archive member: ../file, using 'file' instead
>  x - /tmp/c/file

Thanks for bringing this up.

I believe users need the resolved path (/tmp/c + ../file => /tmp/file;
/tmp/c + /tmp/file => /tmp/file).  The traditional behavior is to
extract the file under the current working directory. Users can easily
predict the output filename.  With --output, users need a second to
think about the resolved path.  A resolved path will be more useful, I
think.



More information about the Binutils mailing list