stow
stow copied to clipboard
chkstow -l only works for directory called 'stow'
Originally reported here:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=806915
Summary
The chkstow --list
command only works when the stow directory is called 'stow'. This is mentioned in a "FIXME" comment in the current version of the source code.
# FIXME: what if the stow dir is not called 'stow'?
http://git.savannah.gnu.org/cgit/stow.git/tree/bin/chkstow.in?id=cc0767597e5f9e23400323b42550e4672160b3c0#n97
Below is a shell script to reproduce the behavior. The chkstow
invocation outputs only
package1
when it should output
package1
package2
Suggested fix: let the chkstow
command take a --dir
flag like stow
does.
Shell script
#! /usr/bin/env bash
mkdir -p target
mkdir -p stow/package1
touch stow/package1/file1
stow --verbose --dir=./stow --target=./target package1
mkdir -p stow2/package2
touch stow2/package2/file2
stow --verbose --dir=./stow2 --target=./target package2
chkstow --target ./target/ --list
Explanation:
There are two files, one in stow/
and one in stow2/
, like this:
$ tree stow stow2
stow
└── package1
└── file1
stow2
└── package2
└── file2
which produces a target like this:
$ file target/*
target/file1: symbolic link to ../stow/package1/file1
target/file2: symbolic link to ../stow2/package2/file2
But chkstow
only recognizes the symlink pointing to stow/
, not the one pointing to stow2/
as well:
$ chkstow --target ./target/ --list
package1
Sounds like a valid bug; thanks for the report!
Wouldn't the right thing here would be to add a --dir
argument to chkstow
? Then you could 're-root' all the relative symlinks into absolute links and grep through all of them keeping only those with shared roots leading to the package being checked (excluding subtrees under those containing .stow
files of course). I'm very interested in this as I would like to use Stow to manage scientific data not software installs. However, it's been about 7 years since I last programmed perl and it's clear I've forgotten just about everything.