Bläddra i källkod

libdpkg: Allow quoting values in configuration file options

Guillem Jover 17 år sedan
förälder
incheckning
355dbdf360
4 ändrade filer med 12 tillägg och 6 borttagningar
  1. 1 0
      debian/changelog
  2. 5 0
      lib/dpkg/myopt.c
  3. 3 3
      man/dpkg.cfg.5
  4. 3 3
      man/dselect.cfg.5

+ 1 - 0
debian/changelog

@@ -42,6 +42,7 @@ dpkg (1.15.4) UNRELEASED; urgency=low
   * Use po4a “--previous” support when updating the man pages.
     Suggested by Christian Perrier <bubulle@debian.org>.
   * On configuration error print file name and line number.
+  * Allow quoting values in configuration file options.
 
   [ Raphael Hertzog ]
   * Replace install-info by a wrapper around GNU's install-info. The wrapper

+ 5 - 0
lib/dpkg/myopt.c

@@ -33,6 +33,7 @@
 #include <stdlib.h>
 
 #include <dpkg/dpkg.h>
+#include <dpkg/string.h>
 #include <dpkg/myopt.h>
 
 void
@@ -94,6 +95,10 @@ void myfileopt(const char* fn, const struct cmdinfo* cmdinfos) {
       *opt++ = '\0';
       if (*opt=='=') opt++;
       while (isspace(*opt)) opt++;
+
+      opt = str_strip_quotes(opt);
+      if (opt == NULL)
+        config_error(fn, line_num, _("unbalanced quotes in '%s'"), linebuf);
     }
 
     for (cip=cmdinfos; cip->olong || cip->oshort; cip++) {

+ 3 - 3
man/dpkg.cfg.5

@@ -1,4 +1,4 @@
-.TH dpkg.cfg 5 "2009-08-20" "Debian Project" "dpkg suite"
+.TH dpkg.cfg 5 "2009-09-05" "Debian Project" "dpkg suite"
 .SH NAME
 dpkg.cfg \- dpkg configuration file
 .
@@ -6,8 +6,8 @@ dpkg.cfg \- dpkg configuration file
 This file contains default options for dpkg. Each line contains a
 single option which is exactly the same as a normal command line
 option for dpkg except for the leading dashes which are not used
-here. Comments are allowed by starting a line with a hash sign
-("\fB#\fR").
+here. Quotes surrounding option values are stripped. Comments are
+allowed by starting a line with a hash sign ("\fB#\fR").
 .
 .SH FILES
 .I /etc/dpkg/dpkg.cfg.d/[0-9a-zA-Z_-]*

+ 3 - 3
man/dselect.cfg.5

@@ -1,4 +1,4 @@
-.TH dselect.cfg 5 "2009-08-20" "Debian Project" "dpkg suite"
+.TH dselect.cfg 5 "2009-09-05" "Debian Project" "dpkg suite"
 .SH NAME
 dselect.cfg \- dselect configuration file
 .
@@ -6,8 +6,8 @@ dselect.cfg \- dselect configuration file
 This file contains default options for dselect. Each line contains a
 single option which is exactly the same as a normal commandline
 option for dselect except for the leading dashes which are not used
-here. Comments are allowed by starting a line with a hash sign
-("\fB#\fR").
+here. Quotes surrounding option values are stripped. Comments are
+allowed by starting a line with a hash sign ("\fB#\fR").
 .
 .SH FILES
 .I /etc/dpkg/dselect.cfg.d/[0-9a-zA-Z_-]*