Re: Parse error - dar does not accept prune directories with trailing slash anymore

Thomas <dar.support.ml-202308-Tv/[email protected]> Tue, 3 Jun 2025 11:15:39 +0200
Newsgroups gmane.comp.sysutils.backup.dar.support
Message-ID <[email protected]>
Hi Denis!

I can confirm my minimal example works with v2.7.19.RC1 with all three
variants like v2.7.16.

It is good to know that there is no difference internally between cdrom
and cdrom/. But it feels right that both are working.

Thanks a lot for your support!

Cheers,
Tom


On Mon, Jun 02, 2025 at 05:29:50PM +0200, Denis Corbin wrote:
> Hi,
> =

> I have reviewed the implementation to accept trailing slashes, this is fi=
xed
> in 2.7.19.RC1 (git and
> https://dar.edrusb.org/dar.linux.free.fr/Interim_releases )
> =

> However, note that dar never considers "bar/" different from "bar". File
> file selection is only based on:
> - path, (-P, -g, -[, -], options...)
> - filename, (-X, -I options)
> - eventually the presence of a nodump flag (--nodump)
> - eventually the presence of a given Extended Attribute (--exclude-by-ea
> options)
> - mount-point / filesystem location (--mount-points option)
> =

> File selection is not based on the inode type
> (directory/file/symlink/chardev/blockdev/named pipe/door inode...) and the
> fact you have specified a trailing slash or not in dar's filtering
> mechanism.
> =

> But yes, at restoration time, when a file has to be updated (differential
> backup and even binary delta), dar checks the nature of the current entry=
 in
> filesystem (and also that the CRC matches before and after a applying bin=
ary
> patch), same thing when a file has to be removed during a restoration (its
> inode type should match), and this is (hopefully) here too, independent f=
rom
> the presence of a training slash, if ever you were restoring with some
> filtering mechanism (to only restore some files/directory/named
> pipes/chardev/blockdev...)
> =

> Cheers,
> Denis
> =

> On 02/06/2025 13:05, Graham Cobb wrote:
> > I *always* type directory paths with a trailing slash. Mostly for the
> > reason John gives but also because that is the way my mind works while I
> > am typing filenames (probably inherited from my earlier RSX and VAX/VMS
> > experience where directories are entered differently if you are
> > operating on the directory or the files within it).
> > =

> > While I realize that I could leave the trailing slash out, after over 40
> > years of using Unix I don't think I can retrain my fingers!
> > =

> > I would certainly prefer if it was possible to fix the DAR filtering
> > problem without breaking trailing slashes.
> > =

> > Regards
> > Graham
> > =

> > On 01/06/2025 20:53, John Goerzen via Dar-support wrote:
> > > I'll just note that a lot of shell expansion will add the trailing sl=
ash
> > > for directories.=A0 It is also something I often use when I want to f=
orce
> > > something to be a directory; for instance, "mv foo bar/" ensures that=
 I
> > > don't overwrite a file named bar with the file named foo, and instead
> > > move foo into the directory named bar.
> > > =

> > > - John
> > > =

> > > On Sun, Jun 01 2025, Denis Corbin wrote:
> > > =

> > > > Hi Thomas,
> > > > =

> > > > Changelog for 2.7.17 reports
> > > > - fixed bug where -R path ending with // was breaking the path filt=
ering
> > > > =A0=A0 mechanism (-P/-g/-[/-] options).
> > > > =

> > > > see commit 503326bf8735d8eab48d4ff0ab9c000ffa031dec
> > > > =

> > > > The fix was needed for the filtering mechanism to work with
> > > > those uncommon but
> > > > valid paths (some//path)... sorry if this impacts training
> > > > slashes. Is it a big
> > > > problem to avoid using trailing slash in paths?
> > > > =

> > > > Regards,
> > > > Denis
> > > > =

> > > > On 01/06/2025 16:53, Thomas wrote:
> > > > > Hi!
> > > > > ;TLDR
> > > > > =3D=3D=3D=3D=3D
> > > > > With v2.7.17 and later one can't use '-P cdrom/' anymore. Dar abo=
rts
> > > > > with the error message:
> > > > > ,---- [=A0 ]
> > > > > | Parse error: cdrom/ is an not a valid path: Empty string
> > > > > as subdirectory
> > > > > | does not make a valid path
> > > > > `----
> > > > > The following works:
> > > > > '-P cdrom'
> > > > > or
> > > > > '-P cdrom/*'
> > > > > Bug or feature?
> > > > > Long version
> > > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> > > > > I have a couple of directories I wan't to have in the backup
> > > > > but without
> > > > > the files.
> > > > > I used for a long time for example '--empty-dir -P cdrom/' without
> > > > > problems.
> > > > > Now with v2.7.17 and v2.7.18 I only get en error message:
> > > > > ,---- [=A0 ]
> > > > > | Parse error: cdrom/ is an not a valid path: Empty string
> > > > > as subdirectory
> > > > > | does not make a valid path
> > > > > `----
> > > > > What went wrong? The message does not enlighten me. I would say c=
drom/
> > > > > is a perfect path and is not empty either.
> > > > > How to reproduce:
> > > > > -----------------
> > > > > export BASE=3D/tmp/dar_debug
> > > > > mkdir -p ${BASE}/bak ${BASE}/files/cdrom
> > > > > touch ${BASE}/files/file1 ${BASE}/files/cdrom/cdromfile1
> > > > > dar --version
> > > > > dar --create ${BASE}/bak/full_with_slash=A0=A0=A0 --empty-dir
> > > > > --fs-root ${BASE}/files/ -P cdrom/
> > > > > dar --create ${BASE}/bak/full_wo_slash=A0=A0=A0=A0=A0 --empty-dir
> > > > > --fs-root ${BASE}/files/ -P cdrom
> > > > > dar --create ${BASE}/bak/full_with_asterisk --empty-dir
> > > > > --fs-root ${BASE}/files/ -P cdrom/*
> > > > > Results with v2.7.16
> > > > > --------------------
> > > > > All three create-commands are working as expected. They generate a
> > > > > backup file including file1 and an empty cdrom directory.
> > > > > cdromfile1 is not included as expected.
> > > > > dar --list ${BASE}/bak/full_with_slash
> > > > > [Data ][D][ EA=A0 ][FSA][Compr][S]| Permission | User=A0 | Group
> > > > > | Size=A0=A0=A0 |=A0=A0=A0=A0=A0=A0=A0=A0=A0 Date=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 |=A0=A0=A0 filename
> > > > > --------------------------------+------------+-------+-------
> > > > > +---------+-------------------------------+------------
> > > > > [Saved][ ]=A0=A0=A0=A0=A0=A0 [---][=A0=A0=A0=A0 ][ ]=A0 -rw-rw-r-=
-=A0=A0 1000=A0=A0=A0
> > > > > 1000=A0=A0=A0 0    Sun Jun=A0 1 12:49:26 2025=A0=A0=A0 file1
> > > > > [Saved][-]=A0=A0=A0=A0=A0=A0 [---][=A0=A0=A0=A0 ][ ]=A0 drwxrwxr-=
x=A0=A0 1000=A0=A0=A0
> > > > > 1000=A0=A0=A0 0    Sun Jun=A0 1 12:49:26 2025=A0=A0=A0 cdrom
> > > > > dar --list ${BASE}/bak/full_wo_slash
> > > > > [Data ][D][ EA=A0 ][FSA][Compr][S]| Permission | User=A0 | Group
> > > > > | Size=A0=A0=A0 |=A0=A0=A0=A0=A0=A0=A0=A0=A0 Date=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 |=A0=A0=A0 filename
> > > > > --------------------------------+------------+-------+-------
> > > > > +---------+-------------------------------+------------
> > > > > [Saved][ ]=A0=A0=A0=A0=A0=A0 [---][=A0=A0=A0=A0 ][ ]=A0 -rw-rw-r-=
-=A0=A0 1000=A0=A0=A0
> > > > > 1000=A0=A0=A0 0    Sun Jun=A0 1 12:49:26 2025=A0=A0=A0 file1
> > > > > [Saved][-]=A0=A0=A0=A0=A0=A0 [---][=A0=A0=A0=A0 ][ ]=A0 drwxrwxr-=
x=A0=A0 1000=A0=A0=A0
> > > > > 1000=A0=A0=A0 0    Sun Jun=A0 1 12:49:26 2025=A0=A0=A0 cdrom
> > > > > dar --list ${BASE}/bak/full_with_asterisk
> > > > > [Data ][D][ EA=A0 ][FSA][Compr][S]| Permission | User=A0 | Group
> > > > > | Size=A0=A0=A0 |=A0=A0=A0=A0=A0=A0=A0=A0=A0 Date=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 |=A0=A0=A0 filename
> > > > > --------------------------------+------------+-------+-------
> > > > > +---------+-------------------------------+------------
> > > > > [Saved][ ]=A0=A0=A0=A0=A0=A0 [---][=A0=A0=A0=A0 ][ ]=A0 -rw-rw-r-=
-=A0=A0 1000=A0=A0=A0
> > > > > 1000=A0=A0=A0 0    Sun Jun=A0 1 12:49:26 2025=A0=A0=A0 file1
> > > > > [Saved][-]=A0=A0=A0=A0=A0=A0 [---][=A0=A0=A0=A0 ][ ]=A0 drwxrwxr-=
x=A0=A0 1000=A0=A0=A0
> > > > > 1000=A0=A0=A0 0    Sun Jun=A0 1 12:49:26 2025=A0=A0=A0 cdrom
> > > > > Results with v2.7.17 and v2.7.18
> > > > > --------------------------------
> > > > > The first create command failes with the error message above.
> > > > > The second and third are working as expected.
> > > > > dar --list ${BASE}/bak/full_with_slash
> > > > > No backup file is present in file:///tmp/dar_debug/bak for archive
> > > > > full_with_slash, please provide the last file of the set.
> > > > > [return =3D YES | Esc
> > > > > =3D NO]
> > > > > dar --list ${BASE}/bak/full_wo_slash
> > > > > [Data ][D][ EA=A0 ][FSA][Compr][S]| Permission | User=A0 | Group
> > > > > | Size=A0=A0=A0 |=A0=A0=A0=A0=A0=A0=A0=A0=A0 Date=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 |=A0=A0=A0 filename
> > > > > --------------------------------+------------+-------+-------
> > > > > +---------+-------------------------------+------------
> > > > > [Saved][ ]=A0=A0=A0=A0=A0=A0 [---][=A0=A0=A0=A0 ][ ]=A0 -rw-rw-r-=
-=A0=A0 1000=A0=A0=A0
> > > > > 1000=A0=A0=A0 0    Sun Jun=A0 1 12:49:26 2025=A0=A0=A0 file1
> > > > > [Saved][-]=A0=A0=A0=A0=A0=A0 [---][=A0=A0=A0=A0 ][ ]=A0 drwxrwxr-=
x=A0=A0 1000=A0=A0=A0
> > > > > 1000=A0=A0=A0 0    Sun Jun=A0 1 12:49:26 2025=A0=A0=A0 cdrom
> > > > > dar --list ${BASE}/bak/full_with_asterisk
> > > > > [Data ][D][ EA=A0 ][FSA][Compr][S]| Permission | User=A0 | Group
> > > > > | Size=A0=A0=A0 |=A0=A0=A0=A0=A0=A0=A0=A0=A0 Date=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 |=A0=A0=A0 filename
> > > > > --------------------------------+------------+-------+-------
> > > > > +---------+-------------------------------+------------
> > > > > [Saved][ ]=A0=A0=A0=A0=A0=A0 [---][=A0=A0=A0=A0 ][ ]=A0 -rw-rw-r-=
-=A0=A0 1000=A0=A0=A0
> > > > > 1000=A0=A0=A0 0    Sun Jun=A0 1 12:49:26 2025=A0=A0=A0 file1
> > > > > [Saved][-]=A0=A0=A0=A0=A0=A0 [---][=A0=A0=A0=A0 ][ ]=A0 drwxrwxr-=
x=A0=A0 1000=A0=A0=A0
> > > > > 1000=A0=A0=A0 0    Sun Jun=A0 1 12:49:26 2025=A0=A0=A0 cdrom
> > > > > Something between v2.7.16 and v2.7.17 has changed.
> > > > > I would say this is a bug but it could be intentional. So my ques=
tion
> > > > > is:
> > > > > Is it a bug or a feature?
> > > > > Thanks for your support.
> > > > > Tom
> > > > > =

> > > =

> > =

> > =

> =