openSUSE / osc

The Command Line Interface to work with an Open Build Service
http://openbuildservice.org/
GNU General Public License v2.0
170 stars 186 forks source link

Running `osc service runall` with disabled source services generates a corrupted tarball #1268

Open rhabacker opened 1 year ago

rhabacker commented 1 year ago

Describe the bug Running osc service runall on a project with source services disabled is normal behaviour, as mentioned here. Doing this with current osc will create a corrupted tarball as shown below.

Versions

To Reproduce Steps to reproduce the behavior:

  1. checkout package osc -A https://api.opensuse.org checkout -r 1 games/vsgExamples && cd $_
  2. run source service osc service runall
  3. see issue - tarball is corrupted

Expected behavior The tar ball should not be corrupted

Screenshots, console outputs

$ osc -A https://api.opensuse.org checkout games/vsgExamples && cd $_

$ ls 
0001-Do-not-install-data-subdirectory.patch  _service   vsgExamples-1.0.0.tar.xz  vsgExamples.changes  vsgExamples.spec

$ cat _service
<services>
<service name="tar_scm" mode="disabled">
    <param name="scm">git</param>
    <param name="url">https://github.com/vsg-dev/vsgExamples.git</param>
    <param name="revision">vsgExamples-1.0.0</param>
    <param name="versionformat">@PARENT_TAG@</param>
    <param name="versionrewrite-pattern">vsgExamples-(.*)</param>    
    <param name="package-meta">no</param>
  </service>
<service name="recompress" mode="disabled">
    <param name="file">*.tar</param>
    <param name="compression">xz</param>
</service>
<service name="set_version" mode="disabled"/>
</services>

$ stat -c %s vsgExamples-1.0.0.tar.xz 
15003792

$ file vsgExamples-1.0.0.tar.xz 
vsgExamples-1.0.0.tar.xz: XZ compressed data

$ osc service runall
Cloning into '/home/osc/games/vsgExamples/vsgExamples'...
55c218e7ff72261d1c844487ba6a3b4b60de7d1d
merge: origin/vsgExamples-1.0.0 - not something we can merge
Already up to date.
55c218e7ff72261d1c844487ba6a3b4b60de7d1d
Identical target file vsgExamples-1.0.0.tar.xz already exists, skipping..
vsgExamples-1.0.0.tar.xz /home/xxx/osc/games/vsgExamples/vsgExamples-1.0.0.tar.xz sind verschieden: Byte 1, Zeile 1

$ stat -c %s vsgExamples-1.0.0.tar.xz 
9

$ file vsgExamples-1.0.0.tar.xz 
vsgExamples-1.0.0.tar.xz: ASCII text, with no line terminators

Additional context

  1. The problem is caused by the executed source service "download_files" which is not included in the _service file.

    
    $ osc -d -v service runall download_files
    makeurl: https://api.opensuse.org ['source', 'games', 'vsgExamples'] cmd=getprojectservices
    POST https://api.opensuse.org/source/games/vsgExamples?cmd=getprojectservices
    makeurl: https://api.opensuse.org ['person', 'xxx'] []
    GET https://api.opensuse.org/person/xxx
    Run source service: /usr/lib/obs/service/download_files --outdir /home/osc/games/vsgExamples/tmpwxc6qua6.download_files.service
    vsgExamples-1.0.0.tar.xz /home/xxx/osc/games/vsgExamples/vsgExamples-1.0.0.tar.xz sind verschieden: Byte 1, Zeile 1
  2. This problem also happens with osc service disabledrun

  3. The corrupted tar ball comes from downloading from an incorrect url, not detected by the download_files source service, which should not overwrite unconditional

  4. Since the tarball has already been created by tar_scm, what is the point of having it overwritten by the call to download_files source service ?

dmach commented 1 year ago

@rhabacker is it still reproducible? Downloading the latest vsgExamples-1.0.3.tar.gz works fine when I run osc service runall

rhabacker commented 1 year ago

@rhabacker is it still reproducible? Downloading the latest vsgExamples-1.0.3.tar.gz works fine when I run `osc service runall

You need to check out revision 1 to see this behaviour, which is still present - I have updated the original report to reflect this.

dmach commented 6 months ago

I tried it again and the reproducer no longer leads to broken vsgExamples-1.0.0.tar.xz Maybe the underlying service got fixed in the meantime? I'm testing it on Tumbleweed.

I think you should actually fix your spec to avoid running download_files. There's a full URL and the tools think that they can download the sources for some reason. Doing this fixes the problem:

-Source0:        https://github.com/vsg-dev/%{name}/archive/%{name}-%{version}.tar.xz
+Source0:        %{name}-%{version}.tar.xz

I'm afraid I can't do much here...