#2378 PR merged: Filter out duplicates in COPY_AS_IS and copy_as_is_filelist_file

Labels: enhancement, cleanup, fixed / solved / done

jsmeix opened issue at 2020-04-23 15:40:

With

# cp -vp /usr/sbin/parted /usr/local/bin
# cp -vp /usr/sbin/partprobe /usr/local/bin

and in etc/rear/local.conf

COPY_AS_IS+=( /usr/local/bin /usr/local/bin /usr/share/man/man8/partprobe.8.gz /usr/share/man/man8/partprobe.8.gz )

I get same files in /tmp/rear.XXXX/rootfs
with and without deduplication.

  • Brief description of the changes in this pull request:

Filter out duplicate entries in COPY_AS_IS
but keep the ordering of the elements
i.e. only the first occurrence of an element is kept.

Also remove duplicates in the copy_as_is_filelist_file
with 'sort -u' because here the ordering does not matter.

Duplicates in the copy_as_is_filelist_file can happen
even if there are no duplicates in COPY_AS_IS
e.g. when COPY_AS_IS contains

/path/to/somedir ... /path/to/somedir/subdir

then tar copies things in /path/to/somedir/subdir two times
and reports them twice in the copy_as_is_filelist_file

jsmeix commented at 2020-04-24 10:24:

If there are no objections I would like to merge it Monday afternoon.


[Export of Github issue for rear/rear.]