[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#187534: dpkg: protect sed commands in Makefile.in from shell



Package: dpkg
Version: 1.10.9
Severity: normal
Tags: patch

There is a sed command that uses characters that have meaning to the
shell in Makefile.in. 

$(MAKE) $(MFLAGS) -C `echo $@ | sed s/[^-]*-//` `echo $@ | sed s/-.*//`

I was playing around with making dpkg work on some things other than
Linux and ran into this. The fix is simple - surround the sed commands
with '', which is a good idea anyway. I've attached a diff that fixes
this problem.

The symptom is the following output from sed on affected systems:
sed: command garbled: s/[
/bin/sh: -]*-//: not found

-- System Information
Debian Release: testing/unstable
Architecture: powerpc
Kernel: Linux amun-ra 2.4.19-xfs #13 Sat Oct 26 14:33:36 CDT 2002 ppc
Locale: LANG=C, LC_CTYPE=C

Versions of packages dpkg depends on:
ii  dselect                       1.10.9     a user tool to manage Debian packa
ii  libc6                         2.3.1-16   GNU C Library: Shared libraries an
Index: Makefile.in
===================================================================
RCS file: /cvs/dpkg/dpkg/Makefile.in,v
retrieving revision 1.15
diff -u -r1.15 Makefile.in
--- Makefile.in	30 Aug 2002 00:36:44 -0000	1.15
+++ Makefile.in	4 Apr 2003 06:07:37 -0000
@@ -34,7 +34,7 @@
 	$(MAKE) $(MFLAGS) $(patsubst %,$*-%,$(SUBDIRS))
 
 $(foreach target,all install clean distclean,$(patsubst %,$(target)-%,$(SUBDIRS))):
-	$(MAKE) $(MFLAGS) -C `echo $@ | sed s/[^-]*-//` `echo $@ | sed s/-.*//`
+	$(MAKE) $(MFLAGS) -C `echo $@ | sed 's/[^-]*-//'` `echo $@ | sed 's/-.*//'`
 
 .PHONY: all install clean distclean 
 .PHONY: all-recursive install-recursive clean-recursive distclean-recursive

Reply to: