Gentoo Archives: gentoo-commits

From: "Markus Meier (maekke)" <maekke@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in media-gfx/comix/files: comix-3.6.4-command-argument-closure.patch comix-3.6.4-tmpfile.patch
Date: Wed, 02 Apr 2008 20:13:56
Message-Id: E1Jh9LD-0002cw-T4@stork.gentoo.org
1 maekke 08/04/02 20:13:51
2
3 Added: comix-3.6.4-command-argument-closure.patch
4 comix-3.6.4-tmpfile.patch
5 Log:
6 revision bump: add patches from fedora, security bug #215694
7 (Portage version: 2.1.4.4)
8
9 Revision Changes Path
10 1.1 media-gfx/comix/files/comix-3.6.4-command-argument-closure.patch
11
12 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-gfx/comix/files/comix-3.6.4-command-argument-closure.patch?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-gfx/comix/files/comix-3.6.4-command-argument-closure.patch?rev=1.1&content-type=text/plain
14
15 Index: comix-3.6.4-command-argument-closure.patch
16 ===================================================================
17 --- comix-3.6.4/comix.debug 2007-05-27 01:30:16.000000000 +0900
18 +++ comix-3.6.4/comix 2008-04-02 20:11:53.000000000 +0900
19 @@ -44,6 +44,9 @@
20 import pwd
21 import cPickle
22
23 +import subprocess
24 +import string
25 +
26 try:
27 import pygtk
28 pygtk.require('2.0')
29 @@ -6277,9 +6280,12 @@
30 archive = tarfile.open(path, 'r')
31 files = archive.getnames()
32 elif type == 'rar':
33 + #files = \
34 + #os.popen(self.rar + ' vb "' + path +
35 + #'"').readlines()
36 files = \
37 - os.popen(self.rar + ' vb "' + path +
38 - '"').readlines()
39 + subprocess.Popen([self.rar, 'vb', path],
40 + stdout=subprocess.PIPE).communicate()[0].splitlines()
41 files = [file.rstrip('\n') for file in files]
42 cover = None
43 files.sort()
44 @@ -6302,9 +6308,20 @@
45 break
46 if cover != None:
47 if type == 'rar':
48 - os.popen(self.rar + ' p -inul -- "' + path + '" "' +
49 - cover + '" > "' + thumb_dir +
50 - '/temp" 2>/dev/null', "r").close()
51 + #os.popen(self.rar + ' p -inul -- "' + path + '" "' +
52 + #cover + '" > "' + thumb_dir +
53 + #'/temp" 2>/dev/null', "r").close()
54 + filen = thumb_dir + '/temp'
55 + try:
56 + os.remove(filen)
57 + except:
58 + pass
59 + fp = open(filen, 'w')
60 + fdp = fp.fileno()
61 + p = subprocess.Popen(
62 + [self.rar, 'p', '-inul', '--', path,
63 + cover ], stdout = fdp).wait()
64 + fp.close()
65 image = Image.open(thumb_dir + '/temp')
66 os.remove(thumb_dir + '/temp')
67 elif type == 'zip':
68 @@ -8733,8 +8750,10 @@
69 # =======================================================
70 elif archive_type == 'rar':
71 if self.rar:
72 - os.popen(
73 - self.rar + ' x "' + src_path + '" "' + dst_path + '"')
74 + #os.popen(
75 + #self.rar + ' x "' + src_path + '" "' + dst_path + '"')
76 + subprocess.Popen(
77 + [self.rar, 'x', src_path, dst_path],stdout=sys.stdout).wait()
78 else:
79 self.statusbar.push(0,
80 _('Could not find the unrar executable. Please install it if you wish to open RAR archives.'))
81 @@ -9168,9 +9187,37 @@
82 self.are_you_sure_dialog.hide()
83 if response != -5:
84 return
85 - os.popen(self.jpegtran + ' -copy all -trim ' + operation +
86 - ' -outfile "' + self.file[self.file_number] + '" "' +
87 - self.file[self.file_number] + '"')
88 + #os.popen(self.jpegtran + ' -copy all -trim ' + operation +
89 + #' -outfile "' + self.file[self.file_number] + '" "' +
90 + #self.file[self.file_number] + '"')
91 + op = operation.split()
92 + op_len = len(op)
93 +
94 + i=1
95 + filen = self.file[self.file_number]
96 + while (1):
97 + tmp_file = filen + '.tmp' + 'z' * i
98 + if os.path.exists(tmp_file):
99 + i += 1
100 + else:
101 + break
102 +
103 + # Ugly hack :(
104 + if op_len == 2:
105 + p = subprocess.Popen(
106 + [self.jpegtran, '-copy', 'all', '-trim', op[0], op[1],
107 + '-outfile', tmp_file, filen],
108 + stdin=sys.stdin, stdout=sys.stdout)
109 + else:
110 + p = subprocess.Popen(
111 + [self.jpegtran, '-copy', 'all', '-trim', op[0],
112 + '-outfile', tmp_file, filen],
113 + stdin=sys.stdin, stdout=sys.stdout)
114 + p.wait()
115 + if p.returncode == 0:
116 + shutil.copymode(filen, tmp_file)
117 + shutil.copy(tmp_file, filen)
118 + os.remove(tmp_file)
119 try:
120 uri = 'file://' + urllib.pathname2url(self.file[self.file_number])
121 thumb_path = md5.new()
122 --- comix-3.6.4/mime/comicthumb.debug 2007-05-27 01:30:16.000000000 +0900
123 +++ comix-3.6.4/mime/comicthumb 2008-04-02 21:11:10.000000000 +0900
124 @@ -22,6 +22,9 @@
125 import StringIO
126 import re
127 import shutil
128 +
129 +import subprocess
130 +
131 try:
132 import Image
133 except:
134 @@ -138,19 +141,35 @@
135 if not rar:
136 print "You must install unrar or rar to thumbnail RAR archives."
137 sys.exit(1)
138 - rarfiles = os.popen('%s vb "%s"' % (rar, compressed_file)).readlines()
139 + #rarfiles = os.popen('%s vb "%s"' % (rar, compressed_file)).readlines()
140 + rarfiles = subprocess.Popen([rar, 'vb', compressed_file],
141 + stdout=subprocess.PIPE).communicate()[0].splitlines()
142 for i in range(len(rarfiles)):
143 rarfiles[i] = rarfiles[i].rstrip("\n")
144 rarfiles.sort()
145 cover = guessCover(rarfiles)
146 if cover:
147 - picture = StringIO.StringIO(os.popen('%s p -inul -- "%s" "%s"'
148 - % (rar, compressed_file, cover), "r").read())
149 + #picture = StringIO.StringIO(os.popen('%s p -inul -- "%s" "%s"'
150 + #% (rar, compressed_file, cover), "r").read())
151 + picture = StringIO.StringIO(subprocess.Popen(
152 + [rar, 'p', '-inul', '--', compressed_file, cover],
153 + stdout=subprocess.PIPE).stdout.read())
154 else:
155 subarchive = first_archive(rarfiles)
156 if subarchive:
157 - os.popen('%s p -inul -- "%s" "%s" > "/tmp/comicthumb/archive%d"'
158 - % (rar, compressed_file, subarchive, depth), "r")
159 + #os.popen('%s p -inul -- "%s" "%s" > "/tmp/comicthumb/archive%d"'
160 + #% (rar, compressed_file, subarchive, depth), "r")
161 + filen = "/tmp/comicthumb/archive%d"%(depth)
162 + try:
163 + os.remove(filen)
164 + except:
165 + pass
166 + fp = open(filen, 'w')
167 + fdp = fp.fileno()
168 + subprocess.Popen(
169 + [rar, 'p', '-inul', '--', compressed_file, subarchive],
170 + stdout = fdp).wait()
171 + fp.close()
172 return get_image("/tmp/comicthumb/archive%d" % (depth),
173 depth + 1)
174 return picture
175
176
177
178 1.1 media-gfx/comix/files/comix-3.6.4-tmpfile.patch
179
180 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-gfx/comix/files/comix-3.6.4-tmpfile.patch?rev=1.1&view=markup
181 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-gfx/comix/files/comix-3.6.4-tmpfile.patch?rev=1.1&content-type=text/plain
182
183 Index: comix-3.6.4-tmpfile.patch
184 ===================================================================
185 --- comix-3.6.4/comix.tmpfile 2008-04-03 01:23:35.000000000 +0900
186 +++ comix-3.6.4/comix 2008-04-03 01:23:35.000000000 +0900
187 @@ -47,6 +47,8 @@
188 import subprocess
189 import string
190
191 +import tempfile
192 +
193 try:
194 import pygtk
195 pygtk.require('2.0')
196 @@ -257,6 +259,8 @@
197 window_height = 0
198 colour_adjust_signal_kill = False
199 colour_adjust_dialog_displayed = False
200 +
201 + _tmp_dir = None
202
203 def close_application(self, widget, event=None):
204
205 @@ -270,8 +274,8 @@
206 self.prefs['page of last file'] = self.file_number
207 if os.path.exists(self.base_dir):
208 shutil.rmtree(self.base_dir)
209 - if len(os.listdir('/tmp/comix')) == 0:
210 - shutil.rmtree('/tmp/comix')
211 + if len(os.listdir(self._tmp_dir)) == 0:
212 + shutil.rmtree(self._tmp_dir)
213 self.exit = True
214
215 # =======================================================
216 @@ -369,9 +373,9 @@
217 # =======================================================
218 if os.path.exists(self.base_dir):
219 shutil.rmtree(self.base_dir)
220 - if os.path.isdir('/tmp/comix'):
221 - if len(os.listdir('/tmp/comix')) == 0:
222 - shutil.rmtree('/tmp/comix')
223 + if os.path.isdir(self._tmp_dir):
224 + if len(os.listdir(self._tmp_dir)) == 0:
225 + shutil.rmtree(self._tmp_dir)
226
227
228 # =======================================================
229 @@ -8027,7 +8031,7 @@
230 return False
231
232 # We don't want to open files from our selves.
233 - if selection.data.startswith('file:///tmp/comix/'):
234 + if selection.data.startswith('file://' + self._tmp_dir):
235 return
236
237 uri = selection.data.strip()
238 @@ -10543,15 +10547,20 @@
239 # The dir is /tmp/comix/<num> where <num> is 1 or higher
240 # depending on the number of Comix sessions opened.
241 # =======================================================
242 - if not os.path.exists('/tmp/comix/'):
243 - os.makedirs('/tmp/comix/')
244 - os.chmod('/tmp/comix/', 0700)
245 + #if not os.path.exists('/tmp/comix/'):
246 + # os.makedirs('/tmp/comix/')
247 + # os.chmod('/tmp/comix/', 0700)
248 +
249 + self._tmp_dir = tempfile.mkdtemp(prefix='comix.', suffix=os.sep,
250 + dir = '/tmp')
251 + self._tmp_dir += "/"
252 +
253 dir_number = 1
254 while 1:
255 - if not os.path.exists('/tmp/comix/' + str(dir_number)):
256 - os.mkdir('/tmp/comix/' + str(dir_number))
257 - os.chmod('/tmp/comix/' + str(dir_number), 0700)
258 - self.base_dir = '/tmp/comix/' + str(dir_number) + '/'
259 + if not os.path.exists(self._tmp_dir + str(dir_number)):
260 + os.mkdir(self._tmp_dir + str(dir_number))
261 + os.chmod(self._tmp_dir + str(dir_number), 0700)
262 + self.base_dir = self._tmp_dir + str(dir_number) + '/'
263 break
264 dir_number += 1
265
266 --- comix-3.6.4/mime/comicthumb.tmpfile 2008-04-03 01:23:35.000000000 +0900
267 +++ comix-3.6.4/mime/comicthumb 2008-04-03 01:29:52.000000000 +0900
268 @@ -24,6 +24,7 @@
269 import shutil
270
271 import subprocess
272 +import tempfile
273
274 try:
275 import Image
276 @@ -51,9 +52,13 @@
277 sys.exit(1)
278
279 # temp directory needed for multiple archives
280 -if not os.path.exists('/tmp/comicthumb/'):
281 - os.makedirs('/tmp/comicthumb/')
282 - os.chmod('/tmp/comicthumb/', 0700)
283 +#if not os.path.exists('/tmp/comicthumb/'):
284 +# os.makedirs('/tmp/comicthumb/')
285 +# os.chmod('/tmp/comicthumb/', 0700)
286 +_tmp_dir = tempfile.mkdtemp(prefix='comixthumb', suffix=os.sep,
287 + dir = '/tmp')
288 +_tmp_dir += "/"
289 +
290
291 # return the first image in the list
292 def first_image (filelist):
293 @@ -104,10 +109,10 @@
294 else:
295 subarchive = first_archive(zipfiles)
296 if subarchive:
297 - output = open("/tmp/comicthumb/archive%d" % (depth), "wb")
298 + output = open( _tmp_dir + "archive%d" % (depth), "wb")
299 output.write(zip.read(subarchive))
300 output.close()
301 - return get_image("/tmp/comicthumb/archive%d" % (depth),
302 + return get_image( _tmp_dir + "archive%d" % (depth),
303 depth + 1)
304 elif tarfile.is_tarfile(compressed_file):
305 TYPE = TYPE or 'cbt'
306 @@ -122,10 +127,10 @@
307 else:
308 subarchive = first_archive(tarfiles)
309 if subarchive:
310 - output = open("/tmp/comicthumb/archive%d" % (depth), "wb")
311 + output = open( _tmp_dir + "archive%d" % (depth), "wb")
312 output.write(tar.extractfile(subarchive).read())
313 output.close()
314 - return get_image("/tmp/comicthumb/archive%d" % (depth),
315 + return get_image( _tmp_dir + "archive%d" % (depth),
316 depth + 1)
317 elif open(compressed_file, 'rb').read(4) == 'Rar!':
318 TYPE = TYPE or 'cbr'
319 @@ -159,7 +164,7 @@
320 if subarchive:
321 #os.popen('%s p -inul -- "%s" "%s" > "/tmp/comicthumb/archive%d"'
322 #% (rar, compressed_file, subarchive, depth), "r")
323 - filen = "/tmp/comicthumb/archive%d"%(depth)
324 + filen = _tmp_dir + "archive%d"%(depth)
325 try:
326 os.remove(filen)
327 except:
328 @@ -170,7 +175,7 @@
329 [rar, 'p', '-inul', '--', compressed_file, subarchive],
330 stdout = fdp).wait()
331 fp.close()
332 - return get_image("/tmp/comicthumb/archive%d" % (depth),
333 + return get_image( _tmp_dir + "archive%d" % (depth),
334 depth + 1)
335 return picture
336
337 @@ -226,8 +231,8 @@
338 exit_flag = 1
339
340 # remove tempory stuff
341 -if os.path.isdir('/tmp/comicthumb/'):
342 - shutil.rmtree('/tmp/comicthumb/')
343 +if os.path.isdir(_tmp_dir):
344 + shutil.rmtree(_tmp_dir)
345
346 # and exit
347 sys.exit(exit_flag)
348
349
350
351 --
352 gentoo-commits@l.g.o mailing list