From 0236d32d283b50473c108407992fff21a08786e6 Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Thu, 15 Oct 2026 23:24:36 +0200 Subject: [PATCH] fix(backups): stop mc pipe panic in S3-only volume backups The mc release in coolify-helper 1.0.17 panics on `mc pipe --quiet`. Drop the flag and keep the progress bar out of failure messages by printing only real errors and the last progress frame. Closes #11995 --- app/Jobs/VolumeBackupJob.php | 6 +++++- tests/Feature/VolumeBackupTest.php | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/Jobs/VolumeBackupJob.php b/app/Jobs/VolumeBackupJob.php index aa34999397..6d39ce6b42 100644 --- a/app/Jobs/VolumeBackupJob.php +++ b/app/Jobs/VolumeBackupJob.php @@ -407,9 +407,13 @@ class VolumeBackupJob implements ShouldBeEncrypted, ShouldQueue ->implode(' '); $resolveOptions = $resolveOptions === '' ? '' : ' '.$resolveOptions; $destination = 'temporary/'.$s3->bucket.$backupLocation; + // `mc pipe --quiet` panics in recent mc releases, so keep its progress bar out of the error output instead. + // Each progress frame starts with "\r", so printing the last field per line keeps only the final frame and real errors. + $mcPipeLog = '/tmp/mc-pipe.log'; $streamScript = 'set -o pipefail; mc alias set'.$resolveOptions.' temporary ' .escapeshellarg($s3->endpoint).' '.escapeshellarg($s3->key).' '.escapeshellarg($s3->secret) - .' >/dev/null && ('.$archiveScript.' | mc pipe --quiet'.$resolveOptions.' '.escapeshellarg($destination).' >/dev/null)' + .' >/dev/null && ('.$archiveScript.' | mc pipe'.$resolveOptions.' '.escapeshellarg($destination).' >/dev/null 2>'.$mcPipeLog + .' || { status=$?; awk -F '.escapeshellarg('\r').' '.escapeshellarg('{ print $NF }').' '.$mcPipeLog.' >&2; exit $status; })' .' && mc stat --json'.$resolveOptions.' '.escapeshellarg($destination) .' | sed -n '.escapeshellarg('s/.*"size":\([0-9][0-9]*\).*/\1/p'); diff --git a/tests/Feature/VolumeBackupTest.php b/tests/Feature/VolumeBackupTest.php index 799e067d3f..3eebee1e34 100644 --- a/tests/Feature/VolumeBackupTest.php +++ b/tests/Feature/VolumeBackupTest.php @@ -2023,8 +2023,10 @@ it('streams S3-only volume backups without creating or copying a local archive', $expectedFilename = 'volume-app-data-1786795200.tar.gz'; Process::assertRan(fn ($process) => str_contains($process->command, 'tar -I') && str_contains($process->command, 'mc pipe') + && ! str_contains($process->command, '--quiet') && str_contains($process->command, '>/dev/null && (compressor=') - && str_contains($process->command, '>/dev/null) && mc stat') + && str_contains($process->command, '>/dev/null 2>/tmp/mc-pipe.log || {') + && str_contains($process->command, '/tmp/mc-pipe.log >&2; exit $status; }) && mc stat') && str_contains($process->command, 'temporary/bucket/') && str_contains($process->command, $expectedFilename) && substr_count($process->command, '--resolve') === 3