Package: debocker
Version: 0.2.6
Severity: important
Tags: patch

Dear Maintainer,

I encountered an error while using debocker in conjunction with the recommended 
version of docker.io. When attempting to run debocker build on a package, the 
process fails with the message: "Error: cannot parse logs (build failed?)".

After analyzing the source code, I identified two root causes related to 
changes in Docker's CLI output:

    Line 476: The docker build command outputs its log to the standard error 
(stderr) stream instead of standard output (stdout). The current code, which 
uses tee, does not handle this correctly, leading to incomplete log capture.

    Line 479: The pattern used to detect a successful build is outdated. 
Docker's output format for a successfully built image has changed from 
'Successfully built <image_id>' to 'writing image <hash_algorithm>:<hash> 
done'. The current script fails to recognize this new pattern, incorrectly 
assuming the build has failed.

The proposed patch addresses both issues. While the fix works for the current 
Docker version, it should be noted that the solution for line 479 (parsing the 
success message) is not universal and might require updates if Docker's output 
format changes again.

-- System Information:
Debian Release: 13.1
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.12.43+deb13-amd64 (SMP w/6 CPU threads; PREEMPT)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=ru_RU.UTF-8, LC_CTYPE=ru_RU.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages debocker depends on:
ii  python3         3.13.5-1
ii  python3-click   8.2.0+0.really.8.1.8-1
ii  python3-debian  1.0.1

Versions of packages debocker recommends:
ii  docker.io  26.1.5+dfsg1-9+b9

debocker suggests no packages.

-- no debconf information
Index: debocker-0.2.6/debocker
===================================================================
--- debocker-0.2.6.orig/debocker
+++ debocker-0.2.6/debocker
@@ -473,10 +473,10 @@ def docker_build_bundle(bundle, no_cache
     if build_arg:
         docker_opts.extend(['--build-arg="{}"'.format(arg) for arg in 
build_arg])
     docker_opts = ' '.join(docker_opts)
-    log_check_call('{} build {} - < {} | tee {}'.format(
+    log_check_call('{} build {} - < {} 2>&1 | tee {}'.format(
         engine, docker_opts, bundle_esc, build_log_esc), shell = True)
     with open(build_log) as f:
-        match = r'Successfully built (\S+)'
+        match = r'writing image sha256:(\S+) done'
         s = f.read().strip()
         if engine == 'podman':
             # Podman prints the container id on the last log line:

Reply via email to