cli icon indicating copy to clipboard operation
cli copied to clipboard

CLI-1403: Some symlinks broken symlinks are wrongly present in artifact

Open regilero opened this issue 5 months ago • 0 comments

Description

  • Symlinks to tracked directories and files but present in untracked directories are kept, while the directory is clearly expected to be removed from the artifact
  • Broken Symlinks are kept in tracked folders but also in untracked folders.

By untracked folder I mean a folder excluded in the .gitignore file which is used in acli push:artifact to exclude some of the folders.

To Reproduce

mkdir allowed
mkdir crap
cd allowed
touch allowed
ln -s ../crap ln_crap_dir
ln -s ../crap/crap ln_crap_file
ln -s ../broken/link broken1
cd ../crap
touch crap
ln -s ../allowed/ ln_allowed_dir
ln -s ../allowed/allowed ln_allowed_file
ln -s ../broken/link broken2
cd ..
# Here we say we want allowed directory and not the crap directory in the artifact:
echo "/crap" >> .gitignore

> ls -alh crap/
total 13K
drwxrwxrwx 1 www-data www-data    0 Sep 18 11:02 .
drwxrwxrwx 1 www-data www-data 8.0K Sep 18 11:02 ..
lrwxr-xr-x 1 www-data www-data 1.1K Sep 18 11:02 broken2 -> ../broken/link
-rwxr-xr-x 1 www-data www-data    0 Sep 18 11:02 crap
lrwxr-xr-x 1 www-data www-data 1.1K Sep 18 11:02 ln_allowed_dir -> ../allowed/
lrwxr-xr-x 1 www-data www-data 1.1K Sep 18 11:02 ln_allowed_file -> ../allowed/allowed
> ls -alh allowed/
total 13K
drwxrwxrwx 1 www-data www-data    0 Sep 18 11:02 .
drwxrwxrwx 1 www-data www-data 8.0K Sep 18 11:02 ..
-rwxr-xr-x 1 www-data www-data    0 Sep 18 11:02 allowed
lrwxr-xr-x 1 www-data www-data 1.1K Sep 18 11:02 broken1 -> ../broken/link
lrwxr-xr-x 1 www-data www-data 1.1K Sep 18 11:02 ln_crap_dir -> ../crap
lrwxr-xr-x 1 www-data www-data 1.1K Sep 18 11:02 ln_crap_file -> ../crap/crap

After artifact generation:

> acli push:artifact  -n  -vvv  --no-clone  --no-push

> ls -alh /tmp/acli-push-artifact/crap/
total 0
drwxr-xr-x  2 www-data www-data 100 Sep 18 11:03 .
drwxr-xr-x 21 www-data www-data 740 Sep 18 11:04 ..
lrwxrwxrwx  1 www-data www-data  14 Sep 18 11:03 broken2 -> ../broken/link
lrwxrwxrwx  1 www-data www-data  11 Sep 18 11:03 ln_allowed_dir -> ../allowed/
lrwxrwxrwx  1 www-data www-data  18 Sep 18 11:03 ln_allowed_file -> ../allowed/allowed
> ls -alh /tmp/acli-push-artifact/allowed
total 0
drwxr-xr-x  2 www-data www-data  80 Sep 18 11:03 .
drwxr-xr-x 21 www-data www-data 740 Sep 18 11:04 ..
-rwxr-xr-x  1 www-data www-data   0 Sep 18 11:02 allowed
lrwxrwxrwx  1 www-data www-data  14 Sep 18 11:03 broken1 -> ../broken/link

Expected behavior

  • /tmp/acli-push-artifact/crap/ should not exists
    • no broken symlink
    • no links to allowed dir or files
    • no directory in fact
  • /tmp/acli-push-artifact/allowed is almost OK, symlinks to crap dir or files were removed but the broken link is still there. Is this the expected result? Maybe not.

The fact that the broken link was keeped is subject of debate, maybe this link will activate on the targeted env for the artifact.

IMHO we should have a --allow-symlinks options in the artifact generation command, and then all symlinks in the forbidden directory should not be kept and crap/ should not be in the artifact, and all the symlinks in allowed/ should be present in the artifact (even the ones to crap/ and broken links) if we --allow-symlinks and none if we do not.

regilero avatar Sep 18 '24 09:09 regilero