dllinject: Track actual attribute writes instead of the requesting flag#500
dllinject: Track actual attribute writes instead of the requesting flag#500nmlgc wants to merge 1 commit intogittup:masterfrom
Conversation
|
Thanks for the fix! Seems like a reasonable workaround, though it does make some current test cases fail, so I haven't merged it yet. t5068 fails, but I think it's just because the 'touch' command now generates two file file write notifications, so the warning gets displayed twice. That can probably be fixed in the test case itself if it's intended. The other problem is t5091 fails, for a reason I don't fully understand yet. The error message I see is: One weird thing I see in the debug log (if the CFLAGS += -NDEBUG line is commented out in src/dllinject/Tupfile) is a bunch of extra NtCreateFile calls with the special file '??\MountPointManager'. I'm not sure if that's related to the top-level directory (tupid == 1) getting put back into the create_list or not. Any idea why that would show up with your change? |
540a437 to
19e10ed
Compare
I think it would be better to just not print the duplicate notification?
Turns out that this was caused by the
These come from the extra calls to |
Opening a file with the `FILE_WRITE_ATTRIBUTES` access right merely *requests* write access to attributes, and does not constitute a write in itself. Previously, this caused issues with tools that need to specify this flag for whatever reason, but didn't actually write or change the attributes of the files they opened with this flag. If those tools lie outside the source tree, Tup will in fact delete all of these files, forcing you to either reinstall the tool or recover the missing files from a backup. (Thankfully, write-protecting the compiler's directory prevents this from succeeding!) This change should still address the node.js use case that initially prompted the check for `FILE_WRITE_ATTRIBUTES` in c7160c8. I couldn't find a definitive list of everything that counts as "attributes", but it does seem to be limited to the timestamps and attribute bits covered by the `FILE_BASIC_INFORMATION` structure.
19e10ed to
f98926c
Compare
Opening a file with the
FILE_WRITE_ATTRIBUTESaccess right merely requests write access to attributes, and does not constitute a write in itself.In particular, this caused a problem with MS-DOS Player, which needs to open every file with
FILE_WRITE_ATTRIBUTES. DOS does not require such a flag for changing a file's mtime through a previously opened file handle, so an emulator needs to open every file with this flag just in case the emulated DOS process decides to change file times later.Using MS-DOS Player to run Turbo C++ 4.0 through Tup then caused this to happen:
None of these were actually written to or had their date changed.
Tup then does in fact delete all files from outside the source tree that MS-DOS Player loaded with
FILE_WRITE_ATTRIBUTES. In this case, this removes the build tool's executable and any#included standard library headers, forcing you to either reinstall the build tool or recover the missing files from a backup. (Thankfully, write-protecting the compiler's directory prevents this from succeeding!)This change should still address the node.js use case that initially prompted the check for
FILE_WRITE_ATTRIBUTESin c7160c8. I couldn't find a definitive list of everything that counts as "attributes", but it does seem to be limited to the timestamps and attribute bits covered by theFILE_BASIC_INFORMATIONstructure.