Bug#1052371: game-data-packager: a crash while rebuilding quake2-full-data deb package

2024-02-07 Thread Sébastien Noel
On Thu, 21 Sep 2023 08:29:24 +0300 undef  wrote:
> Package: game-data-packager
> Version: 63
> Severity: normal
> 
> Dear Maintainer,
> when I tried to build quake2-full-data from the existing deb package
> gdb crashed
> 
>[..]

I was able to easily reproduce the crash.
A fix could be as simple as

--- a/game_data_packager/build.py
+++ b/game_data_packager/build.py
@@ -903,7 +903,7 @@ class PackagingTask:
 if provider is None:
 try_to_unpack: Collection[str] = self.game.files
 should_provide = set()
-distinctive_dirs = False
+distinctive_dirs = True
 else:
 try_to_unpack = set(f.name for f in
provider.provides_files)
 should_provide = set(try_to_unpack)


but i'm not familiar enough with that part of the code to have a full
view of the implications of that change...

Context:
- the file provided on the CLI is "unknown/untrusted" by g-d-p and so
there isn't any "provider" for the stream and for that case,
'distinctive_dirs' was set to False (what's the reasoning for that ?)

- quake2 have multiple (different) gamefiles that have the same
basename()

- the way we loop through the files in the unpacker and the gamefiles
lead to a tentative to seek backward when 'distinctive_dirs' is False
(we tries to extract dir1/file.md2 instead of dir2/file.md2)


I don't know why we should treat "unknown" stream with
'distinctive_dirs = False' by default, but maybe I'm missing something?


br,
Sébastien



Bug#1052371: game-data-packager: a crash while rebuilding quake2-full-data deb package

2023-09-20 Thread undef

Package: game-data-packager
Version: 63
Severity: normal

Dear Maintainer,
when I tried to build quake2-full-data from the existing deb package gdb
crashed

game-data-packager quake2 quake2-full-data_63_all.deb
...
extracting ./usr/share/games/quake2/baseq2/pak2.pak from 
/home/undef/debian/gdp/quake2-full-data_63_all.deb
extracting ./usr/share/games/quake2/baseq2/pak3.pak from 
/home/undef/debian/gdp/quake2-full-data_63_all.deb
extracting 
./usr/share/games/quake2/baseq2/players/crakhor/a_grenades.md2 from 
/home/undef/debian/gdp/quake2-full-data_63_all.deb

dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File 
"/usr/share/games/game-data-packager/game_data_packager/command_line.py", 
line 365, in 

    run_command_line()
  File 
"/usr/share/games/game-data-packager/game_data_packager/command_line.py", 
line 362, in run_command_line

    task.run_command_line(parsed)
  File 
"/usr/share/games/game-data-packager/game_data_packager/build.py", line 
1688, in run_command_line

    binary_executables=args.binary_executables)
  File 
"/usr/share/games/game-data-packager/game_data_packager/build.py", line 
1614, in look_for_files

    self.consider_file_or_dir(arg)
  File 
"/usr/share/games/game-data-packager/game_data_packager/build.py", line 
465, in consider_file_or_dir

    self.consider_file(path, True)
  File 
"/usr/share/games/game-data-packager/game_data_packager/build.py", line 
424, in consider_file

    self.consider_stream(path, tar)
  File 
"/usr/share/games/game-data-packager/game_data_packager/build.py", line 
728, in consider_stream

    info='extracting %s from %s' % (entry.name, name)),
  File 
"/usr/share/games/game-data-packager/game_data_packager/data.py", line 
54, in from_file

    return cls.from_concatenated_files(name, [f], write_to, size, progress)
  File 
"/usr/share/games/game-data-packager/game_data_packager/data.py", line 
72, in from_concatenated_files

    blob = f.read(io.DEFAULT_BUFFER_SIZE)
  File "/usr/lib/python3.7/tarfile.py", line 706, in readinto
    buf = self.read(len(b))
  File "/usr/lib/python3.7/tarfile.py", line 694, in read
    self.fileobj.seek(offset + (self.position - start))
  File "/usr/lib/python3.7/tarfile.py", line 520, in seek
    raise StreamError("seeking backwards is not allowed")
tarfile.StreamError: seeking backwards is not allowed

This issue is reproducible with gdp 63, 70, 76, master.