On 10/27/25 12:54 AM, Ron via Talk wrote: [snip]
https://www.gnu.org/software/tar/manual/html_node/Incremental-Dumps.html
The option ‘--listed-incremental’ instructs tar to operate on an incremental archive with additional metadata stored in a standalone file, called a snapshot file. The purpose of this file is to help determine which files have been changed, added or *deleted* since the last backup
Interesting feature. I did not know about this.
Turns out, it will *only* work if the source to tar does not contain a file glob, like `file?`.
The snapshot file will contain no info about what was archived and tar won't therefore know to remove file2.
Does this make sense, or sound like a bug?
Turns out, it can be made to work:
Extracting ../2.tar with --incremental-listed: drwxr-xr-x root/root 15 2025-10-26 21:48 ./source/ tar: Deleting ‘./source/file2’ -rw-r--r-- root/root 0 2025-10-26 21:48 ./source/file3
If I run `tar ... file*` then no incremental archive.
When tar is actually invoked at the system call level the result is not "tar","file*" It is more like "tar","file1","file2","file3","filebob"... If you delete a file. Lets say file3 your next invocation of tar will be "tar","file1","file2","filebob"... If you backup a directory your invocation to tar looks like "tar","/etc/dirtobackup" You next invocation of tar will look exactly the saem even though you may have removed /etc/dirtobackup/file3 At that point if tar keeps track of the directory information in /etc/dirtobackup it can use that to determine what files have been deleted.
If I run `tar ... $folder_name` then everything works as desired.
Very weird, counter-intuitive, and not documented (IMHO).
What do you think?
Well it is arguably working exactly as documented so long as you are also reading the shell and system call documents. I get your frustration and the tar documentation might be a bit more user friendly if it said you should only backup directories to use the incremental feature. But I would say it works correctly. As a general rule a program that provides synchronization like adds,changes and deletions work on the level of directories or filesystems and not in discrete file lists. The trouble with adding features to a program is that each new feature adds more corners for the cases to get lost in. -- Alvin Starr || land: (905)513-7688 Netvel Inc. || Cell: (416)806-0133 alvin@netvel.net ||