Package: stow
Version: 2.4.1-2
Severity: normal

  Hi,
  In some situation, "stow -R" fails when there are empty directories.
Here is an example:

$ tree .
.
├── dest
└── from
    ├── A
    │   ├── d1
    │   │   └── fa
    │   └── d2
    │       └── fa2
    ├── B
    │   └── d1
    │       └── fb
    └── C
        └── d1

10 directories, 3 files
$ stow -v  --dir from --target dest -R A B C
LINK: d1 => ../from/A/d1
LINK: d2 => ../from/A/d2
UNLINK: d1 (reverts previous action)
MKDIR: d1
LINK: d1/fa => ../../from/A/d1/fa
LINK: d1/fb => ../../from/B/d1/fb
$ tree .
.
├── dest
│   ├── d1
│   │   ├── fa -> ../../from/A/d1/fa
│   │   └── fb -> ../../from/B/d1/fb
│   └── d2 -> ../from/A/d2
└── from
    ├── A
    │   ├── d1
    │   │   └── fa
    │   └── d2
    │       └── fa2
    ├── B
    │   └── d1
    │       └── fb
    └── C
        └── d1

12 directories, 5 files
$ stow -v  --dir from --target dest -R A B C
UNLINK: d1/fa
UNLINK: d1/fb
RMDIR d1
LINK: d1 => ../from/B/d1
UNLINK: d2
UNLINK: d1 (reverts previous action)
stow: ERROR: unstow_contents() called with invalid target: d1

When initial stow is done (or restow without a previous stow as shown here), it 
works.
But the last case, with a real restow (but no changes in sources), leads to an 
error.
If I put a file in from/C/d1, it works (not shown here).
If I change the package order, it might work!

$ stow -v  --dir from --target dest -R A C B
UNLINK: d1/fa
UNLINK: d1/fb
RMDIR d1
LINK: d1 => ../from/B/d1
UNLINK: d2
UNLINK: d1 (reverts previous action)
LINK: d1 => ../from/A/d1
LINK: d2 => ../from/A/d2 (reverts previous action)
UNLINK: d1 (reverts previous action)
MKDIR: d1 (reverts previous action)
LINK: d1/fa => ../../from/A/d1/fa (reverts previous action)
LINK: d1/fb => ../../from/B/d1/fb (reverts previous action)

[B and C packages are swaped on the command line, no other changes]

  Regards,
    Vincent

-- System Information:
Debian Release: 13.0
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 
'oldstable-updates'), (500, 'oldstable-security'), (500, 'unstable'), (500, 
'testing'), (500, 'stable'), (500, 'oldstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386, armel

Kernel: Linux 6.12.29-amd64 (SMP w/4 CPU threads; PREEMPT)
Kernel taint flags: TAINT_OOT_MODULE
Locale: LANG=fr_FR.utf8, LC_CTYPE=fr_FR.utf8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages stow depends on:
ii  perl  5.40.1-3

stow recommends no packages.

Versions of packages stow suggests:
ii  doc-base  0.11.2

-- no debconf information

Reply via email to