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/914819e6500c478f6d346aa0c20a261ccae9a592?hp=0000000000000000000000000000000000000000> at 914819e6500c478f6d346aa0c20a261ccae9a592 (commit) - Log ----------------------------------------------------------------- commit 914819e6500c478f6d346aa0c20a261ccae9a592 Author: Tony Cook <[email protected]> Date: Thu Jan 12 13:52:04 2017 +1100 (perl #127663) test we fail if the work file can't be renamed and ensure we (attempt to) clean up the work file M doio.c M t/run/switches.t commit f28c6eb15f27ab408ffe1ec16bd6efa9268af706 Author: Tony Cook <[email protected]> Date: Thu Jan 12 13:51:01 2017 +1100 (perl #127663) test we fail if the backup rename fails and that we clean up the temp file M doio.c M t/run/switches.t commit c89249729fd1be1b1bd8f8d04ea73d3d3934fc31 Author: Tony Cook <[email protected]> Date: Thu Jan 12 11:02:52 2017 +1100 (perl #127663) clean up any files left behind The rename work file test will leave the work file, if the other tests fail for some reason they might also leave files. M t/run/switches.t commit 271d4989f14ebb03821f0adcebdb1f649ad0c688 Author: Tony Cook <[email protected]> Date: Thu Jan 12 10:58:58 2017 +1100 (perl #127663) don't do inplace renaming etc in child processes This avoids trying to rename the work file over the original multiple times, which could make the implicit (or explicit) close fail. This is an incompatibility with the pre-workfile version of in-place editing, since you could previously fork a child to do process a given file, but hopefully this is a rare case. M doio.c M t/run/switches.t commit d51e2af333b2ab10dfe08b70b1d563ba6b50011d Author: Tony Cook <[email protected]> Date: Thu Jan 12 10:26:47 2017 +1100 (perl #127663) don't do inplace renaming etc in child threads This also avoids double closedir()ing the directory handle. M doio.c M t/run/switches.t commit 518878b89ffb3593268085f01bac74e9a3d6fed2 Author: Tony Cook <[email protected]> Date: Mon Jan 9 17:02:38 2017 +1100 (perl #127663) test chdir() within an in-place edit loop M t/run/switches.t commit 17b65c51e0925326aca8c603129f11c0083c6ba5 Author: Tony Cook <[email protected]> Date: Tue Dec 13 09:03:08 2016 +1100 (perl #127663) use *at() functions to handle perl code that chdirs Unfortunately this means systems that don't have the *at() functions aren't protected from code that chdir()s in the middle of in-place editing a file. M doio.c commit 1fba1a1b565cf5df5cac4c2465df37678143a7d2 Author: Tony Cook <[email protected]> Date: Mon Dec 12 14:26:30 2016 +1100 add probes for openat, unlinkat, renameat, linkat and fchmodat M Configure M Cross/config.sh-arm-linux M NetWare/config.wc M Porting/Glossary M Porting/config.sh M config_h.SH M configure.com M plan9/config_sh.sample M symbian/config.sh M uconfig.h M uconfig.sh M uconfig64.sh M win32/config.ce M win32/config.gc M win32/config.vc commit 95e983a2cf2a6a277af169e8f541ee12260d37be Author: Tony Cook <[email protected]> Date: Thu Dec 8 09:38:55 2016 +1100 (perl #127663) provide limited control for the internal drand48() perl can be built without PERL_INTERNAL_RAND_SEED support to reduce it's attack surface. M INSTALL M perl.c M pod/perlrun.pod commit d62c646f1930ba55ff51a3e22719d8ea8ce9064c 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 5d74a4dcbd498b66ea869d8b68bb879361456f09 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 755a949dc2e412bf665d939bf3f3eb0baa440264 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 d2c7c58446b5742347f05ed9f02100ff12984205 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 44ac50efa250e12d4f753c57912adbd45c3d3fdb Author: Tony Cook <[email protected]> Date: Wed Jan 11 14:49:53 2017 +1100 (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. M doio.c M embed.fnc M embed.h M mg.c M pod/perldiag.pod M proto.h commit 33d7c9cd541ec8e21a4ae61315c4a099e1e32ce1 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 9bdf2e0d9a9b9ed263419e4620af1838235cea02 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 68d61416fefceb8396ffbd7c43269b3be4fda5cf 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
