This is an archive of the discontinued LLVM Phabricator instance.

[lldb] [Commands] Remove 'append' from 'platform file open' mode
ClosedPublic

Authored by mgorny on Aug 6 2021, 12:47 PM.

Details

Summary

Remove File::eOpenOptionAppend from the mode used by 'platform file
open' command. According to POSIX, O_APPEND causes all successive
writes to be done at the end of the file. This effectively makes
the offset argument to 'platform file write' meaningless.

Furthermore, apparently O_APPEND is not implemented reliably everywhere.
The Linux manpage for pwrite(2) suggests that Linux does not respect
O_APPEND there, so the actual behavior would be dependent on how
the vFile:pwrite packet is implemented on the server.

Ideally, the mode used for opening flags would be provided via options.
However, changing the default mode seems to be a reasonable intermediate
solution.

Diff Detail

Event Timeline

mgorny requested review of this revision.Aug 6 2021, 12:47 PM
mgorny created this revision.
labath accepted this revision.Sep 8 2021, 4:31 AM

Sounds reasonable.

The Linux manpage for pwrite(2) suggests that Linux does not respect O_APPEND there,

I guess it would be more correct to say that it "respects" O_APPEND, when it fact POSIX says it shouldn't.

This revision is now accepted and ready to land.Sep 8 2021, 4:31 AM
mgorny added a comment.Sep 8 2021, 6:28 AM

Thanks, I'll improve the commit message as suggested.

This revision was landed with ongoing or failed builds.Sep 8 2021, 6:42 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptSep 8 2021, 6:42 AM