debian/rules: "$(shell cd ..." causes make to execute a directory

Bug #680866 reported by Peter Kruse
4
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pacemaker (Ubuntu)
Expired
Undecided
Unassigned

Bug Description

Binary package hint: pacemaker

Hello,

in debian/rules you have:

        $(shell cd xml && for a in *-1.0.rng; do ln -s "$$a" `echo "$$a" | sed 's/-1.0//g'`; done)

I'm sorry to inform you that this contains at least two errors:

running "dpkg-buildpackage" ends with:

# set rng compatibility symlinks
/scratch/build/system/cluster/pacemaker/pacemaker-1.0.9.1/xml
make: execvp: /scratch/build/system/cluster/pacemaker/pacemaker-1.0.9.1/xml: Permission denied
make: *** [build-stamp] Error 127
dpkg-buildpackage: error: debian/rules build gave error exit status 2

the reason for this error is that the expression "$(shell cd xml ..." causes the cd command to
print out the current directory which then "make" tries to execute. Now I don't know if this
is the correct behaviour of the "shell" but you certainly can observe this behaviour in bash
scripts if the argument to the "cd" command is neither absolute nor contains a slash.
Anyways I still think that the correct way to change a directory in a makefile is:

        (cd xml && for ...)

doing this brings us to the second error:

# set rng compatibility symlinks
(cd xml && for a in *-1.0.rng; do ln -s "$a" `echo "$a" | sed 's/-1.0//g'`; done)
/scratch/build/system/cluster/pacemaker/pacemaker-1.0.9.1/xml
ln: target `score.rng' is not a directory
make: *** [build-stamp] Error 1
dpkg-buildpackage: error: debian/rules build gave error exit status 2

now what's wrong here? the directory xml does not contain any file
that matches the pattern '*-1.0.rng' which means that the for loop is
run once with $a = '*-1.0.rng' and I don't think this is intended.

this brings me to the conclusion:
since there no file that matches the desired pattern, you might
as well remove this line.

best regards,

  Peter

Revision history for this message
Peter Kruse (pjodrr) wrote :

the problem occurs when the environment variable CDPATH is set

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

I can't reproduce a build failure. If you still have this problem, then please reply.

Changed in pacemaker (Ubuntu):
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for pacemaker (Ubuntu) because there has been no activity for 60 days.]

Changed in pacemaker (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.