fix(immutable-backups): ensure shell is in english

This commit is contained in:
Florent BEAUCHAMP
2026-07-28 16:16:49 +02:00
committed by Florent BEAUCHAMP
parent 4a1269b898
commit 69dfeeaaf6
2 changed files with 8 additions and 5 deletions

View File

@@ -8,17 +8,18 @@ export async function makeImmutable(dirPath: string): Promise<void> {
// chattr processes all paths even when some are missing (it does not abort on the first // chattr processes all paths even when some are missing (it does not abort on the first
// error), so every existing path is correctly lifted. // error), so every existing path is correctly lifted.
// //
// Per-path "while trying to stat" messages (ENOENT) are silently ignored regardless of // Per-path "while trying to stat" messages (ENOENT) are silently ignored — these are always
// locale — these are always expected for optional paths (.xva, .alias.vhd, …) that are // expected for optional paths (.xva, .alias.vhd, …) that are absent in delta backups. chattr
// absent in delta backups. chattr localises the error description but "while trying to // translates that whole message, so it is run under `LC_ALL=C`: without it, every batch
// stat" is always emitted in English, so we match on that suffix only. // containing an optional missing path fails on a localised system, which means no backup ever
// gets locked there.
// //
// Any other error (e.g. EAGAIN on NFS when the file is still open, permission denied) is // Any other error (e.g. EAGAIN on NFS when the file is still open, permission denied) is
// retried up to 3 times with a 1 s delay before being re-thrown. // retried up to 3 times with a 1 s delay before being re-thrown.
async function execChattrWithMissingFiles(args: string[]): Promise<void> { async function execChattrWithMissingFiles(args: string[]): Promise<void> {
for (let attempt = 0; ; attempt++) { for (let attempt = 0; ; attempt++) {
try { try {
await execa('chattr', args) await execa('chattr', args, { env: { LC_ALL: 'C' } })
return return
} catch (err) { } catch (err) {
const stderr = (err as ExecaError).stderr ?? '' const stderr = (err as ExecaError).stderr ?? ''

View File

@@ -16,6 +16,7 @@
### Bug fixes ### Bug fixes
> Users must be able to say: "I had this issue, happy to know it's fixed" > Users must be able to say: "I had this issue, happy to know it's fixed"
- [Immutable backups] Backups are protected again on file servers whose system language is not English: immutability was silently not applied at all on those (PR [#10182](https://github.com/vatesfr/xen-orchestra/pull/10182))
### Packages to release ### Packages to release
@@ -33,6 +34,7 @@
<!--packages-start--> <!--packages-start-->
- @xen-orchestra/immutable-backups patch
- @xen-orchestra/web minor - @xen-orchestra/web minor
<!--packages-end--> <!--packages-end-->