Bug 142635 - patch behavior differs depending on where /tmp is located
Summary: patch behavior differs depending on where /tmp is located
Status: RESOLVED FIXED
Alias: None
Product: SUSE Linux 10.1
Classification: openSUSE
Component: Basesystem (show other bugs)
Version: Alpha 4
Hardware: Other Other
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: Andreas Gruenbacher
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-11 16:55 UTC by Andreas Gruenbacher
Modified: 2006-01-12 06:59 UTC (History)
0 users

See Also:
Found By: Other
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Gruenbacher 2006-01-11 16:55:33 UTC
Patch succeeds in patching a read-only file if /tmp is on the same file system as the patches file (case A), and fails if /tmp is on another file system (case B):

Case A:
rename("/tmp/poz7rGZg", "mm/filemap.c") = 0
stat("mm/filemap.c", {st_mode=S_IFREG|0644, st_size=65396, ...}) = 0
chmod("mm/filemap.c", 0100444)          = 0

Case B:
rename("/tmp/poIg66mc", "mm/filemap.c") = -1 EXDEV (Invalid cross-device link)
mkdir("mm", 0777)                       = -1 EEXIST (File exists)
open("/tmp/poIg66mc", O_RDONLY|O_LARGEFILE) = 4
open("mm/filemap.c", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0100644) = -1 EACCES (Permission denied)

It should exhibit the same behavior in both cases; this could be achieved by first unlinking the destination file in case B, either after seeing -EACCES, or before trying the open that currently fails.
Comment 1 Andreas Gruenbacher 2006-01-12 06:59:53 UTC
Found to be an obscure bug in my patch remember-backup-files.diff.