Bugzilla – Bug 142635
patch behavior differs depending on where /tmp is located
Last modified: 2006-01-12 06:59:53 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.
Found to be an obscure bug in my patch remember-backup-files.diff.