Added some code to peer into a data structure in Maemian/Schedule.pm. Also added the
[maemian] / nokia-lintian / debian / patches / 800-correct-perm2oct.dpatch
1 #! /bin/sh /usr/share/dpatch/dpatch-run
2 ## 800-correct-perm2oct.dpatch by Eero Häkkinen <eero.hakkinen@nokia.com>
3 ##
4 ## All lines beginning with `## DP:' are a description of the patch.
5 ## DP: Fix perm2oct to correctly detect set-{user,group}-ID and sticky bits.
6
7 @DPATCH@
8 diff -urNad lintian-1.23.8~/checks/control-files lintian-1.23.8/checks/control-files
9 --- lintian-1.23.8~/checks/control-files        2006-07-18 12:12:55.000000000 +0000
10 +++ lintian-1.23.8/checks/control-files 2006-07-18 12:15:10.000000000 +0000
11 @@ -20,6 +20,7 @@
12  
13  package Lintian::control_files;
14  use strict;
15 +use PermModes;
16  use Tags;
17  
18  sub run {
19 @@ -104,30 +105,6 @@
20  
21  } # </run>
22  
23 -# translate permission strings like `-rwxrwxrwx' into an octal number
24 -sub perm2oct {
25 -    my ($t) = @_;
26 -
27 -    my $o = 0;
28 -
29 -    $t =~ m/^.(.)(.)(.)(.)(.)(.)(.)(.)(.)/o;
30 -
31 -    $o += 04000 if $3 eq 's';  # set-uid
32 -    $o += 02000 if $6 eq 's';  # set-gid
33 -    $o += 01000 if $9 eq 't';  # sticky bit
34 -    $o += 00400 if $1 ne '-';  # owner read
35 -    $o += 00200 if $2 ne '-';  # owner write
36 -    $o += 00100 if $3 ne '-';  # owner execute
37 -    $o += 00040 if $4 ne '-';  # owner read
38 -    $o += 00020 if $5 ne '-';  # owner write
39 -    $o += 00010 if $6 ne '-';  # owner execute
40 -    $o += 00004 if $7 ne '-';  # owner read
41 -    $o += 00002 if $8 ne '-';  # owner write
42 -    $o += 00001 if $9 ne '-';  # owner execute
43 -
44 -    return $o;
45 -}
46 -
47  1;
48  
49  # vim: syntax=perl sw=4 ts=8
50 diff -urNad lintian-1.23.8~/checks/files lintian-1.23.8/checks/files
51 --- lintian-1.23.8~/checks/files        2006-07-18 12:14:48.000000000 +0000
52 +++ lintian-1.23.8/checks/files 2006-07-18 12:15:10.000000000 +0000
53 @@ -21,6 +21,7 @@
54  package Lintian::files;
55  use strict;
56  use Dep;
57 +use PermModes;
58  use Tags;
59  use Util;
60  
61 @@ -763,30 +764,6 @@
62  
63  }
64  
65 -# translate permission strings like `-rwxrwxrwx' into an octal number
66 -sub perm2oct {
67 -    my ($t) = @_;
68 -
69 -    my $o = 0;
70 -
71 -    $t =~ m/^.(.)(.)(.)(.)(.)(.)(.)(.)(.)/;
72 -
73 -    $o += 04000 if $3 eq 's';  # set-uid
74 -    $o += 02000 if $6 eq 's';  # set-gid
75 -    $o += 01000 if $9 eq 't';  # sticky bit
76 -    $o += 00400 if $1 ne '-';  # owner read
77 -    $o += 00200 if $2 ne '-';  # owner write
78 -    $o += 00100 if $3 ne '-';  # owner execute
79 -    $o += 00040 if $4 ne '-';  # owner read
80 -    $o += 00020 if $5 ne '-';  # owner write
81 -    $o += 00010 if $6 ne '-';  # owner execute
82 -    $o += 00004 if $7 ne '-';  # owner read
83 -    $o += 00002 if $8 ne '-';  # owner write
84 -    $o += 00001 if $9 ne '-';  # owner execute
85 -
86 -    return $o;
87 -}
88 -
89  1;
90  
91  # vim: syntax=perl ts=8 sw=4
92 diff -urNad lintian-1.23.8~/checks/menus lintian-1.23.8/checks/menus
93 --- lintian-1.23.8~/checks/menus        2006-07-18 12:12:55.000000000 +0000
94 +++ lintian-1.23.8/checks/menus 2006-07-18 12:16:29.000000000 +0000
95 @@ -22,6 +22,7 @@
96  
97  package Lintian::menus;
98  use strict;
99 +use PermModes;
100  use Tags;
101  use Util;
102  
103 @@ -207,30 +208,6 @@
104  
105  # -----------------------------------
106  
107 -# translate permission strings like `-rwxrwxrwx' into an octal number
108 -sub perm2oct {
109 -    my ($t) = @_;
110 -
111 -    my $o = 0;
112 -
113 -    $t =~ /^.(.)(.)(.)(.)(.)(.)(.)(.)(.)/o;
114 -
115 -    $o += 04000 if $3 eq 's';  # set-uid
116 -    $o += 02000 if $6 eq 's';  # set-gid
117 -    $o += 01000 if $9 eq 't';  # sticky bit
118 -    $o += 00400 if $1 ne '-';  # owner read
119 -    $o += 00200 if $2 ne '-';  # owner write
120 -    $o += 00100 if $3 ne '-';  # owner execute
121 -    $o += 00040 if $4 ne '-';  # owner read
122 -    $o += 00020 if $5 ne '-';  # owner write
123 -    $o += 00010 if $6 ne '-';  # owner execute
124 -    $o += 00004 if $7 ne '-';  # owner read
125 -    $o += 00002 if $8 ne '-';  # owner write
126 -    $o += 00001 if $9 ne '-';  # owner execute
127 -
128 -    return $o;
129 -}
130 -
131  sub check_script {
132      my ($script,$pres) = @_;
133      my ($no_check_menu,$no_check_installdocs,$no_check_wmmenu,$calls_wmmenu);
134 diff -urNad lintian-1.23.8~/checks/shared-libs lintian-1.23.8/checks/shared-libs
135 --- lintian-1.23.8~/checks/shared-libs  2006-07-18 12:14:48.000000000 +0000
136 +++ lintian-1.23.8/checks/shared-libs   2006-07-18 12:15:10.000000000 +0000
137 @@ -20,6 +20,7 @@
138  
139  package Lintian::shared_libs;
140  use strict;
141 +use PermModes;
142  use Tags;
143  use File::Basename;
144  use Util;
145 @@ -395,30 +396,6 @@
146  
147  }
148  
149 -# translate permission strings like `-rwxrwxrwx' into an octal number
150 -sub perm2oct {
151 -    my ($t) = @_;
152 -
153 -    my $o = 0;
154 -
155 -    $t =~ m/^.(.)(.)(.)(.)(.)(.)(.)(.)(.)/o;
156 -
157 -    $o += 04000 if $3 eq 's';  # set-uid
158 -    $o += 02000 if $6 eq 's';  # set-gid
159 -    $o += 01000 if $9 eq 't';  # sticky bit
160 -    $o += 00400 if $1 ne '-';  # owner read
161 -    $o += 00200 if $2 ne '-';  # owner write
162 -    $o += 00100 if $3 ne '-';  # owner execute
163 -    $o += 00040 if $4 ne '-';  # owner read
164 -    $o += 00020 if $5 ne '-';  # owner write
165 -    $o += 00010 if $6 ne '-';  # owner execute
166 -    $o += 00004 if $7 ne '-';  # owner read
167 -    $o += 00002 if $8 ne '-';  # owner write
168 -    $o += 00001 if $9 ne '-';  # owner execute
169 -
170 -    return $o;
171 -}
172 -
173  # make /tmp/baz/baz.txt from /tmp/foo/../bar/../baz/baz.txt
174  sub abs_path {
175      my $path = shift;
176 diff -urNad lintian-1.23.8~/lib/PermModes.pm lintian-1.23.8/lib/PermModes.pm
177 --- lintian-1.23.8~/lib/PermModes.pm    1970-01-01 00:00:00.000000000 +0000
178 +++ lintian-1.23.8/lib/PermModes.pm     2006-07-18 12:15:10.000000000 +0000
179 @@ -0,0 +1,52 @@
180 +# Hey emacs! This is a -*- Perl -*- script!
181 +# PermModes -- Perl file permission mode functions for lintian
182 +
183 +# Copyright (C) 2006 Nokia Corporation.
184 +#
185 +# This program is free software; you can redistribute it and/or modify
186 +# it under the terms of the GNU General Public License as published by
187 +# the Free Software Foundation; either version 2 of the License, or
188 +# (at your option) any later version.
189 +#
190 +# This program is distributed in the hope that it will be useful,
191 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
192 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
193 +# GNU General Public License for more details.
194 +#
195 +# You should have received a copy of the GNU General Public License
196 +# along with this program.  If not, you can find it on the World Wide
197 +# Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free
198 +# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
199 +# MA 02110-1301, USA.
200 +
201 +package PermModes;
202 +use strict;
203 +use warnings;
204 +
205 +use Exporter;
206 +our @ISA    = qw( Exporter );
207 +our @EXPORT = qw(
208 +       perm2oct
209 +       );
210 +
211 +# translate permission strings like `-rwxrwxrwx' into an octal number
212 +sub perm2oct($)
213 +{
214 +       my @c = split "", shift, 11;
215 +       my $oct = 0;
216 +       $oct |= 04000 if $c[3] =~ /s/i;          # set-user-ID
217 +       $oct |= 02000 if $c[6] =~ /s/i;          # set-group-ID
218 +       $oct |= 01000 if $c[9] =~ /t/i;          # sticky
219 +       $oct |= 00400 if $c[1] eq 'r';           # user readable
220 +       $oct |= 00200 if $c[2] eq 'w';           # user writable
221 +       $oct |= 00100 if $c[3] =~ /[[:lower:]]/; # user executable
222 +       $oct |= 00040 if $c[4] eq 'r';           # group readable
223 +       $oct |= 00020 if $c[5] eq 'w';           # group writable
224 +       $oct |= 00010 if $c[6] =~ /[[:lower:]]/; # group executable
225 +       $oct |= 00004 if $c[7] eq 'r';           # world readable
226 +       $oct |= 00002 if $c[8] eq 'w';           # world writable
227 +       $oct |= 00001 if $c[9] =~ /[[:lower:]]/; # world executable
228 +       return $oct;
229 +}
230 +
231 +1;