Talk:ar (Unix)

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Ar vs tar[edit]

I've never entirely understood the differences in intent between ar and tar. I know that ar can create a symbol index for object files in the archive; and that tar has many more options for the structure of the file and the restoring of (e.g.) ownership and permissions. However, it's not clear to me, for instance, why the Debian package format (.deb files) prefers ar over tar, even though debs do not rely on a symbol index. --FOo 23:10, 10 Nov 2004 (UTC)

IIRC the ar format was chosen simply because it was sufficient and simpler to implement in dpkg :) --Joy [shallot] 10:42, 11 Nov 2004 (UTC)
Whilst you're a Debian developer and may know better, I was under the impression that ar was used because it was possible to get libmagic/file(1) to recognise .debs as Debian packages. In any case, dpkg handles tar.gz files. --Lucidion 14:14, 13 September 2006 (UTC)[reply]

Just a heads up...the file format as specified is currently incorrect/incomplete when referring to GNU ar. Dkmcnulty (talk) 03:16, 25 August 2009 (UTC)[reply]

Not sure how to mention this on the page without mangling since it's off-topic, but the fileformat for 'ar' is the exact same as for pecoff's archive (.lib) files. Creating an entry for the .lib format in Lib would largely result in a duplication of this Ar_(Unix) entry. -- 074fadd47e36c5627a2e7857a4ec480d920b96ea -- Anonymous (talk) 03:58, 29 December 2009 (UTC) —Preceding unsigned comment added by 66.68.167.173 (talk)

-L/-l being bad programming[edit]

The comment about being able to achieve linking results with -L. -lclass being bad programming seems to me to be subjective and/or oddly placed; I think that this comment should either be sourced or removed. Elehack (talk) 21:32, 4 March 2010 (UTC)[reply]

It is not only subjective but it is wrong. When using -L/-l the linker will only link the object files really needed. If the ar file contains unused object files these will not be linked. Using the file name of the ar file some linkers (I tried that with an old version of GNU ld for Windows) will link all object files into the executable even if they are not needed. Mr1278 (talk) 07:33, 19 July 2010 (UTC)[reply]

Example usage[edit]

I was curious so I played around with ar on my GNU/Linux system a little:

$ ar --version
GNU ar (GNU Binutils for Ubuntu) 2.21.0.20110327
Copyright 2011 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) any later version.
This program has absolutely no warranty.
$ echo 'This sentence is the contents of the first file.' > one.file
$ echo 'And this is inside the other file.' > two.file
$ ar -rc files.ar one.file two.file
$ cat files.ar 
!<arch>
one.file/       1337732246  1000  1000  100644  49        `
This sentence is the contents of the first file.

two.file/       1337732277  1000  1000  100644  35        `
And this is inside the other file.

$ hd files.ar
00000000  21 3c 61 72 63 68 3e 0a  6f 6e 65 2e 66 69 6c 65  |!<arch>.one.file|
00000010  2f 20 20 20 20 20 20 20  31 33 33 37 37 33 32 32  |/       13377322|
00000020  34 36 20 20 31 30 30 30  20 20 31 30 30 30 20 20  |46  1000  1000  |
00000030  31 30 30 36 34 34 20 20  34 39 20 20 20 20 20 20  |100644  49      |
00000040  20 20 60 0a 54 68 69 73  20 73 65 6e 74 65 6e 63  |  `.This sentenc|
00000050  65 20 69 73 20 74 68 65  20 63 6f 6e 74 65 6e 74  |e is the content|
00000060  73 20 6f 66 20 74 68 65  20 66 69 72 73 74 20 66  |s of the first f|
00000070  69 6c 65 2e 0a 0a 74 77  6f 2e 66 69 6c 65 2f 20  |ile...two.file/ |
00000080  20 20 20 20 20 20 31 33  33 37 37 33 32 32 37 37  |      1337732277|
00000090  20 20 31 30 30 30 20 20  31 30 30 30 20 20 31 30  |  1000  1000  10|
000000a0  30 36 34 34 20 20 33 35  20 20 20 20 20 20 20 20  |0644  35        |
000000b0  60 0a 41 6e 64 20 74 68  69 73 20 69 73 20 69 6e  |`.And this is in|
000000c0  73 69 64 65 20 74 68 65  20 6f 74 68 65 72 20 66  |side the other f|
000000d0  69 6c 65 2e 0a 0a                                 |ile...|
000000d6

- 193.84.186.81 (talk) 02:10, 23 May 2012 (UTC)[reply]

External links modified[edit]

Hello fellow Wikipedians,

I have just modified one external link on Ar (Unix). Please take a moment to review my edit. If you have any questions, or need the bot to ignore the links, or the page altogether, please visit this simple FaQ for additional information. I made the following changes:

When you have finished reviewing my changes, you may follow the instructions on the template below to fix any issues with the URLs.

This message was posted before February 2018. After February 2018, "External links modified" talk page sections are no longer generated or monitored by InternetArchiveBot. No special action is required regarding these talk page notices, other than regular verification using the archive tool instructions below. Editors have permission to delete these "External links modified" talk page sections if they want to de-clutter talk pages, but see the RfC before doing mass systematic removals. This message is updated dynamically through the template {{source check}} (last update: 18 January 2022).

  • If you have discovered URLs which were erroneously considered dead by the bot, you can report them with this tool.
  • If you found an error with any archives or the URLs themselves, you can fix them with this tool.

Cheers.—InternetArchiveBot (Report bug) 03:26, 14 September 2017 (UTC)[reply]

Removed "refimprove section"[edit]

Hello all,

I removed the "refimprove section" template. All sections of the articles are referenced. Please tell me, in case you don't agree.

Best regards --Hundsrose (talk) 12:20, 9 December 2018 (UTC)[reply]