Sfoglia il codice sorgente

Let dpkg-source -b warn about special permissions of files added
in the diff since these will get lost. Closes: #306125

Frank Lichtenheld 20 anni fa
parent
commit
3c5ae80199
3 ha cambiato i file con 15 aggiunte e 0 eliminazioni
  1. 4 0
      ChangeLog
  2. 2 0
      debian/changelog
  3. 9 0
      scripts/dpkg-source.pl

+ 4 - 0
ChangeLog

@@ -17,6 +17,10 @@
 	* man/C/dselect.1: Update reference to debconf
 	man page with correct section (8->1)
 
+	* scripts/dpkg-source.pl: Warn on -b if we add a file with
+	special (i.e. exectuable or set{u,g}id) permission in the
+	diff since this mode will get lost.
+
 2005-10-07  Frank Lichtenheld  <djpig@debian.org>
 
 	* scripts/controllib.pl:

+ 2 - 0
debian/changelog

@@ -27,6 +27,8 @@ dpkg (1.13.12~) unstable; urgency=low
   * Fix man page references to dpkg and dselect man pages. Many
     of them still had a wrong section.
     Closes: #332826
+  * Let dpkg-source -b warn about special permissions of files added
+    in the diff since these will get lost. Closes: #306125
 
  --
 

+ 9 - 0
scripts/dpkg-source.pl

@@ -34,6 +34,7 @@ $def_dscformat = "1.0"; # default format for -b
 
 use POSIX;
 use POSIX qw (:errno_h :signal_h);
+use Fcntl qw (:mode);
 
 use strict 'refs';
 
@@ -405,6 +406,7 @@ if ($opmode eq 'build') {
             next file if $fn =~ m/$diff_ignore_regexp/o;
             $fn =~ s,^\./,,;
             lstat("$dir/$fn") || &syserr("cannot stat file $dir/$fn");
+	    my $mode = S_IMODE((lstat(_))[2]);
             if (-l _) {
                 $type{$fn}= 'symlink';
                 &checktype('-l') || next;
@@ -418,6 +420,13 @@ if ($opmode eq 'build') {
                 if (!lstat("$origdir/$fn")) {
                     $! == ENOENT || &syserr("cannot stat orig file $origdir/$fn");
                     $ofnread= '/dev/null';
+		    if( $mode & ( S_IXUSR | SIXGRP | S_IXOTH ) ) {
+			&warn( sprintf( "executable mode %04o of `$fn' will not be represented in diff", $mode ) )
+			    unless $fn eq 'debian/rules';
+		    }
+		    if( $mode & ( S_ISUID | S_IGID | S_ISVTX ) ) {
+			&warn( sprintf( "special mode %04o of `$fn' will not be represented in diff", $mode ) );
+		    }
                 } elsif (-f _) {
                     $ofnread= "$origdir/$fn";
                 } else {