Opened 10 years ago

#8425 new Bugs

[filesystem][documentation] copy_file cannot overwrite executing binary

Reported by: boost@… Owned by: Beman Dawes
Milestone: To Be Determined Component: filesystem
Version: Boost 1.51.0 Severity: Cosmetic
Keywords: overwrite executable Linux Cc:

Description

If trying to copy a binary file over the currently executing program, then the copy_file call fails even though it has the overwrite_if_exists flag.

Examining the code, this appears to be because copy_file_api (Linux) uses popen, thus attempts to write to the same file data as distinct from creating a new file node.

The peculiar error "Text file busy: <binary>" is reported.

Given that the Windows version would not (AFAIK) be able to achieve this anyway, I would say that this behaviour is "by design" but suggest a documentation update for copy_file.

Change History (0)

Note: See TracTickets for help on using tickets.