system-manager icon indicating copy to clipboard operation
system-manager copied to clipboard

Logic error if file copy required in subdirectory already referenced by a symlink entry

Open srd424 opened this issue 9 months ago • 1 comments

Describe the bug

      etc = {
        "systemd/network/wg0.netdev" =
          { source = ./etc/wg0.netdev;              user = "root"; group = "root"; mode = "0640"; };

This should copy the file not symlink it, but:

[2025-03-24T21:33:42Z DEBUG system_manager::activate::etc_files] Entering into directory /etc/systemd...
[2025-03-24T21:33:42Z DEBUG system_manager::activate::etc_files] Entering into directory /etc/systemd/network...
[2025-03-24T21:33:42Z INFO  system_manager] Creating symlink: /etc/systemd/network/wg0.netdev -> ./../../.system-manager-static/systemd/network/wg0.netdev
[2025-03-24T21:33:42Z INFO  system_manager] Creating symlink: /etc/systemd/network/wg0.netdev.mode -> ./../../.system-manager-static/systemd/network/wg0.netdev.mode
[2025-03-24T21:33:42Z INFO  system_manager] Creating symlink: /etc/systemd/network/wg0.netdev.uid -> ./../../.system-manager-static/systemd/network/wg0.netdev.uid
[2025-03-24T21:33:42Z INFO  system_manager] Creating symlink: /etc/systemd/network/wg0.netdev.gid -> ./../../.system-manager-static/systemd/network/wg0.netdev.gid
[2025-03-24T21:33:42Z DEBUG system_manager::activate::etc_files] Entering into directory /etc/systemd/system...
[2025-03-24T21:33:42Z INFO  system_manager] Creating symlink: /etc/systemd/system/system-manager-path.service -> ./../../.system-manager-static/systemd/system/system-manager-path.service

To Reproduce

The above snippet should be good enough - I believe the automatically added components under systemd/system trigger the error in combination with it.

Expected behavior

The file should copied, not symlinked, and symlinks should not be made to xxx.uid, xxx.gid, xxx.mode, etc.

System information

HEAD as of time of writing.

srd424 avatar Mar 24 '25 21:03 srd424

I'm really struggling to follow the code, but I wonder if we need to store EtcFiles (or something very similar) in the FileTrees?

srd424 avatar Mar 24 '25 23:03 srd424