Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chkstow -l only works for directory called 'stow' #61

Open
nbeaver opened this issue Jun 30, 2019 · 2 comments
Open

chkstow -l only works for directory called 'stow' #61

nbeaver opened this issue Jun 30, 2019 · 2 comments

Comments

@nbeaver
Copy link

nbeaver commented Jun 30, 2019

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
@aspiers
Copy link
Owner

aspiers commented Jul 21, 2019

Sounds like a valid bug; thanks for the report!

@wdkrnls
Copy link

wdkrnls commented Jun 18, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants