Bug#682622: mr fails to find configured repositories when homedir is a symlink

2012-07-24 Thread Sam Eaton
Package: mr
Version: 1.12~bpo60+1
Severity: normal

When mr is run in an environment where the home directory is a symlink, it
fails to recognise any repositories that are configured, and thus will not
respond to any commands, giving the error: 

mr list: no repositories found to work on

Home dir is as follows : 

lrwxrwxrwx 1 root root   22 Dec 27  2011 sam - /srv/d_garlic/home/sam

~  pwd
/home/sam

~  perl -MCwd -e 'print Cwd::getcwd() . \n'
/srv/d_garlic/home/sam

mr config consists of repositories configured like this : 

[$HOME/.oh-my-zsh]
checkout = git clone --recursive https://github.com/sorin-ionescu/oh-my-zsh.git
.oh-my-zsh

The issue appears to be that the 'selectrepos()' function in mr checks if the
repos are subdirectories of the cwd on line 1058: 

next if $dir ne $d  $dir !~ /^\Q$d\E/;

$d is set from $directory, which is set by Cwd::getcwd()

In my particular configuration with a symlinked home, this gives repos that
expand $HOME to give repos like:

DB2 x $dir
0  '/home/sam/.config/vcsh/repo.d/mr.git/'

Compared to the cwd, which is like this:

DB3 x $d
0  '/srv/d_garlic/home/sam/'

I realise I can fix this by changing the repo definitions to not use $HOME, or
to make $HOME point at the target of the symlink, but the repo definitions are
shared between many machines as I use this to sync dotfiles across multiple
machines, so I'd rather stick with a generic $HOME

I've 'fixed' this on my local machine by editing the code to use $ENV{PWD}
instead of Cwd:getcwd(), but I don't know if this is a generally applicable
solution for others, or if there's a nicer way to solve it.

Thanks,

Sam.

-- System Information:
Debian Release: 6.0.5
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.32-xenU-6434-i386 (SMP w/1 CPU core)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

mr depends on no packages.

Versions of packages mr recommends:
ii  libhtml-parser-perl3.66-1collection of modules that parse H
ii  libwww-perl5.837-1   The World-Wide Web library for Per
ii  perl   5.10.1-17squeeze3 Larry Wall's Practical Extraction 

Versions of packages mr suggests:
pn  bzr none   (no description available)
ii  curl7.21.0-2.1+squeeze2  Get a file from an HTTP, HTTPS or 
pn  cvs none   (no description available)
pn  darcs   none   (no description available)
pn  fossil  none   (no description available)
ii  git [git-core]  1:1.7.10-1~bpo60+1   fast, scalable, distributed revisi
ii  git-core1:1.7.10-1~bpo60+1   fast, scalable, distributed revisi
ii  liburi-perl 1.60-1~bpo60+1   module to manipulate and access UR
ii  mercurial   1.6.4-1  scalable distributed version contr
ii  subversion  1.6.12dfsg-6 Advanced version control system
ii  vcsh0.20120227-1~bpo60+1 manage config files in $HOME via f

-- no debconf information


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#682622: mr fails to find configured repositories when homedir is a symlink

2012-07-24 Thread Joey Hess
Sam Eaton wrote:
 [$HOME/.oh-my-zsh]

There is no reason to use $HOME here, and it is the cause of your
problem. Relative directories in .mrconfig files are relative to the
directory in which the file is located. So [.oh-my-zsh] will automatically
do the right thing, when the .mrconfig file is located in $HOME. (And if
it's located in /tmp/just-testing/.mrconfig, you'll get
/tmp/just-testing/.oh-my-zsh, which is also a nice things.)

 I've 'fixed' this on my local machine by editing the code to use $ENV{PWD}
 instead of Cwd:getcwd(), but I don't know if this is a generally applicable
 solution for others, or if there's a nicer way to solve it.

PWD is not set by all shells.

-- 
see shy jo


signature.asc
Description: Digital signature