rose icon indicating copy to clipboard operation
rose copied to clipboard

File creation gives error when using checksum with mode=symlink

Open MartinDix opened this issue 2 years ago • 1 comments

Trying to install a file with

mode=symlink
checksum=....

gives an error. Demonstrated by modifying a test in 04-stdin.t to add a symlink case https://github.com/MartinDix/rose/commit/4030fa5f0fae84fc69033caba2b214d2b331f708

not ok 13 - 04-stdin-md5-symlink
[FAIL] 'NoneType' object is not subscriptable

The problem is the same in 2019.01.5 (with python 2.7.17) and 2.0rc3.dev (python 3.7.4)

It seems that in fileinstall.py copies go into a list of jobs whereas links are created immediately and that only the job processing sets target.paths. With a symlink, target.paths is None at https://github.com/MartinDix/rose/blob/4030fa5f0fae84fc69033caba2b214d2b331f708/metomi/rose/config_processors/fileinstall.py#L386

MartinDix avatar May 02 '22 04:05 MartinDix

Also repeatable as follows:

$ touch rose-app.conf
$ rose app-run -q --define="[command]default=true" --define="[file:installed]source=/etc/profile" --define="[file:installed]checksum=" --define="[file:installed]mode=symlink"
[FAIL] 'NoneType' object is not subscriptable

The documentation says checksum works "if TARGET is a regular file or a symbolic link to a regular file" so this is certainly meant to work.

dpmatthews avatar May 12 '22 15:05 dpmatthews