In perl.git, the branch smoke-me/tonyc/127663-safe-inplace-in-do_close has been created
<http://perl5.git.perl.org/perl.git/commitdiff/8e328fc443869085a370f7de98d5c41b4848ee49?hp=0000000000000000000000000000000000000000> at 8e328fc443869085a370f7de98d5c41b4848ee49 (commit) - Log ----------------------------------------------------------------- commit 8e328fc443869085a370f7de98d5c41b4848ee49 Author: Tony Cook <[email protected]> Date: Tue Aug 2 16:05:22 2016 +1000 (perl #127663) test that die/exit leave the original file M t/run/switches.t commit 58d3a7f96ab9d396a44133bdebf225239879a02e Author: Tony Cook <[email protected]> Date: Wed Aug 3 14:43:59 2016 +1000 (perl #127663) discard any output if not closed properly It can be closed by either iterating to the next file, or by an explicit close(ARGVOUT); M doio.c commit 075043d3289c352bc2b0575cd6e2496ca4fb5c8d Author: Tony Cook <[email protected]> Date: Tue May 24 09:06:18 2016 +1000 (perl #127663) add more in-place edit tests test that setuid is preserved with nested in-place editing, which fails previously. M t/io/nargv.t M t/run/switches.t commit ed2ebe0d9083dc9f009bd987333ccd216d4d3c4c Author: Tony Cook <[email protected]> Date: Thu May 19 15:22:32 2016 +1000 (perl #127663) all platforms no longer require a backup file Platforms that disallow deleting an open file, like Win32, Cygwin, previously required a backup extension (defaulted for Cygwin), but since we now write to a work file that's no longer necessary (but might still be desirable.) M perl.c commit d9946fe662551bd64b9d49a9bb88e3606040390f Author: Tony Cook <[email protected]> Date: Thu Aug 4 14:34:35 2016 +1000 (perl #127663) safer in-place editing Previously in-place editing opened the file then immediately *replaced* the file, so if an error occurs while writing the output, such as running out of space, the content of the original file is lost. This changes in-place editing to write to a work file which is renamed over the original only once the output file is successfully closed. It also fixes an issue with setting setuid/setgid file modes for recursive in-place editing. The implementation (beyond some TODO issues below) has at least one problem - if the user code changes directory between the file open and the close then the final clean-up stage is going to fail if the input name wasn't an absolute path. This might be fixable, but on some systems it may put the perl process in a difficult to recover from position - if the system doesn't implement getcwd() perl may change directory out of the original and not have a way to return to it. M doio.c M embed.fnc M embed.h M mg.c M pod/perldiag.pod M proto.h commit 69e7365dce884a5ff5f99ae62fdba82e5f430da2 Author: Tony Cook <[email protected]> Date: Thu Aug 4 14:34:21 2016 +1000 (perl #127663) only test renaming directories with rename() available. Perl's rename implementation falls back to link() to rename when rename() isn't available, which is either disallowed or dangerous. M t/io/fs.t commit ee5c68b6dd0d9330e7040edef06854278d098766 Author: Tony Cook <[email protected]> Date: Thu Aug 4 14:30:13 2016 +1000 (perl #127663) add our own mkstemp() implementation Needed to generate temp files for safer in-place editing. Not based on any particular implementation, the BSD implementations tend to be wrappers around a megafunction that also does a few variations of mkstemp() and mkdtemp(), which we don't need (yet.) One implementation I found, part of the heimdal crypto library, was simpler, but horrible. M embed.fnc M proto.h M util.c M util.h commit ecdd0c8dc1cc35cdace9f67e5e08f7822e12813c Author: Tony Cook <[email protected]> Date: Wed May 18 15:03:14 2016 +1000 (perl #127663) create a separate random souce for internal use and use it to initialize hash randomization and to innoculate against quadratic behaviour in pp_sort M embedvar.h M intrpvar.h M perl.c M pp_sort.c M util.c M util.h ----------------------------------------------------------------------- -- Perl5 Master Repository
