[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Quilt-dev] Fix mode on backup files
From: |
Andreas Gruenbacher |
Subject: |
Re: [Quilt-dev] Fix mode on backup files |
Date: |
Tue, 01 Jun 2004 22:58:57 +0200 |
Hi Dean,
On Tue, 2004-06-01 at 22:04, Dean Roehrich wrote:
> The use of backup files broke a few months ago, and I've been sitting on the
> patch for awhile. The mode on the backup needs to match the original.
>
> Dean
>
>
> Index: work/lib/backup-files.c
> ===================================================================
> --- work.orig/lib/backup-files.c 2004-04-09 10:10:13.000000000 -0500
> +++ work/lib/backup-files.c 2004-04-20 16:39:11.000000000 -0500
> @@ -189,6 +189,7 @@
> goto fail;
> if (rename(tmpname, filename))
> goto fail;
> + chmod(filename, st.st_mode);
Okay, so we should preserve the original file mode as much as possible,
I agree with that. There is no such mechanism for files created in
patches, but for pre-existing files this may well make a difference. (In
fact we can do a fchmod here.)
> error = 0;
> fail:
> @@ -239,7 +240,7 @@
> if (link_or_copy(file, &st, backup))
> return 1;
> if (opt_nolinks) {
> - if (ensure_nolinks(file))
> + if (ensure_nolinks(backup))
> return 1;
The idea here was to ensure that the original file doesn't have more
than one hardlink after a patch touches it (or after a patch is
removed). This makes it a lot less likely that a file is modified while
its backup file is modified at the same time. I don't understand why
that would matter for the backup file.
Thanks,
--
Andreas Gruenbacher <address@hidden>
SUSE Labs, SUSE LINUX AG