aspiers/stow

chkstow -l only works for directory called 'stow'

Open

#61 opened on Jun 30, 2019

View on GitHub
 (2 comments) (0 reactions) (0 assignees)Perl (1,013 stars) (51 forks)batch import
bughelp wanted

Description

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

Contributor guide