[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-tar] Exitcodes when creating archives

From: Pavel Raiskup
Subject: Re: [Help-tar] Exitcodes when creating archives
Date: Tue, 12 May 2015 14:35:18 +0200
User-agent: KMail/4.14.7 (Linux/3.19.5-200.fc21.x86_64+debug; KDE/4.14.7; x86_64; ; )

On Monday 11 of May 2015 21:02:11 Benibr wrote:
> my company is maintaining an patched version of tar because some scripts
> expect an exitcode 0 even if the archived files change while creating
> the tar file.
> I read the tar manual [1] and figured out, that an exitcode 1 should be
> uncritical while creating an archive since tar 1.19. I also read the
> (patched) sourcecode and didn't find any part which says something else.
> However I couln't figure out how to proof that.

There may be a bug of course, but the value 1 is meant to be non-critical
issue from your POV, at least for GNU tar [2]:

  1 `Some files differ'. If tar was invoked with `--compare' (`--diff',
    `-d') command line option, this means that some files in the archive
    differ from their disk counterparts (see section Comparing Archive
    Members with the File System). If tar was given `--create', `--append'
    or `--update' option, this exit code means that some files were
    changed while being archived and so the resulting archive does not
    contain the exact copy of the file set.

> So the question is: can I be absolutly sure that an exitcode 1 is only
> thrown when a file changes while creating the archive? A possible
> command would be "tar --numeric-owner --listed-incremental -cpPf"

Your command should be safe.  But note that [2]:

  If tar has invoked a subprocess and that subprocess exited with a
  nonzero exit code, tar exits with that code as well. This can happen,
  for example, if tar was given some compression option ..

> [1]



reply via email to

[Prev in Thread] Current Thread [Next in Thread]