From 3c5ae80199cb3683412bbb8e66699ce60a4f58cc Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Wed, 18 Jan 2006 14:27:39 +0000 Subject: [PATCH] Let dpkg-source -b warn about special permissions of files added in the diff since these will get lost. Closes: #306125 --- ChangeLog | 4 ++++ debian/changelog | 2 ++ scripts/dpkg-source.pl | 9 +++++++++ 3 files changed, 15 insertions(+) diff --git a/ChangeLog b/ChangeLog index 2d27bd3d..adf386fc 100644 --- a/ChangeLog +++ b/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 * scripts/controllib.pl: diff --git a/debian/changelog b/debian/changelog index a9db95f7..8f3702fc 100644 --- a/debian/changelog +++ b/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 -- diff --git a/scripts/dpkg-source.pl b/scripts/dpkg-source.pl index edbbd8eb..2c52a46d 100755 --- a/scripts/dpkg-source.pl +++ b/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 { -- 2.39.5