Commit Graph

121 Commits

Author SHA1 Message Date
Georg Brandl cc0274b90f merge with 3.2 2012-08-25 10:12:47 +02:00
Georg Brandl c8076dfa9d Fix wrong way of adding Error information in shutil.copytree. 2012-08-25 10:11:57 +02:00
Hynek Schlawack 26fe37dd3f #1492704: Backout and wait for 3.4 2012-07-19 21:41:02 +02:00
Hynek Schlawack 77d3283370 #1492704: Make shutil.copyfile() raise a distinct SameFileError
Patch by Atsuo Ishimoto.
2012-07-19 20:23:49 +02:00
Larry Hastings b40380667c Issue #15202: Consistently use the name "follow_symlinks" for
new parameters in os and shutil functions.  Patch by Serhiy Storchaka.
2012-07-15 10:57:38 -07:00
Larry Hastings ad5ae0456e - Issue #15238: shutil.copystat now copies Linux "extended attributes". 2012-07-14 17:55:11 -07:00
Hynek Schlawack d0f6e0a6e6 Check for all used fd-based functions in shutil.rmdir, closes #15218 2012-06-29 08:28:20 +02:00
Hynek Schlawack 9f558ccefd #4489: Use dir_fd in rmdir in _rmtree_safe_fd()
Now that rmdir supports dir_fd, we also use it. Attackers can't even delete
empty directories anymore.
2012-06-28 15:30:47 +02:00
Hynek Schlawack a75cd1ce73 #4489: Don't follow ever symlinks in rmtree
Also added several regression tests.
2012-06-28 12:07:29 +02:00
Hynek Schlawack 3b52778c74 #4489 Make fd based rmtree work on bytes 2012-06-25 13:27:31 +02:00
Ned Deily 5fddf866d8 Issue #14662: Prevent shutil failures on OS X when destination does not
support chflag operations.  (Patch by Hynek Schlawack)
2012-05-10 17:21:23 -07:00
Éric Araujo 89dfd5cf80 Really make bztar support in shutil conditional.
This dict entry is added a few lines after if the bzip2 module is
available, but removing this line was forgotten.
2012-02-05 13:40:08 +01:00
Florent Xicluna 5d1155c08e Closes #13258: Use callable() built-in in the standard library. 2011-10-28 14:45:05 +02:00
Éric Araujo 5fa8e7a559 Add missing name in shutil 2011-08-21 14:29:18 +02:00
Éric Araujo 43a7ee1f3b Make logging call lazy 2011-08-19 02:55:11 +02:00
Ronald Oussoren 78349b06af merge from 3.1 2011-05-06 10:57:22 +02:00
Ronald Oussoren f51738b10e Fix for issue 10684: Folders get deleted when trying to change case with shutil.move (case insensitive file systems only) 2011-05-06 10:23:04 +02:00
Nick Coghlan abf202d798 Close #11548: Correctly handle format argument in shutil.unpack_archive 2011-03-16 13:52:20 -04:00
Éric Araujo ac4e58eb61 Protect logging call against None argument (fixes #11045).
Initial patch by Kelsey Hightower.  Approved by Raymond.  A test was
non-trivial to write without calling the private function directly, so
we moved that for later.
2011-01-29 20:32:11 +00:00
Éric Araujo 4433a5fdc0 Fix wrong name in docstring and doc (#10693). Original patch by Eli Bendersky. 2010-12-15 20:26:30 +00:00
Nick Coghlan 5b0eca116a Issue #4489: Rename the feature marker for the symlink resistant rmtree and store it as a function attribute 2012-06-24 16:43:06 +10:00
Philip Jenvey 88bc0d2640 small refactor and PEP8 line width/docstring 2012-06-23 15:54:38 -07:00
Hynek Schlawack 2100b42317 #4489: Fix usage of fd-based functions to new api introduced earlier today
Also add an explicit test for safe implementation usage on supported platforms.

As a side effect, this commit adds a module-level attribute 'rmtree_is_safe'
which offers introspection whether the current rmtree implementation is safe
against symlink attacks.
2012-06-23 20:28:32 +02:00
Hynek Schlawack 67be92bed4 #4489: Add a shutil.rmtree that isn't suspectible to symlink attacks
It is used automatically on platforms supporting the necessary os.openat() and
os.unlinkat() functions. Main code by Martin von Löwis.
2012-06-23 17:58:42 +02:00
Brian Curtin dc00f1eba0 Fix #15148. Capitalize PATH, hopefully leading to less confusion 2012-06-22 22:49:12 -05:00
Brian Curtin 2193536e79 Fix #15148. Make the shutil.which docstring more thorough 2012-06-22 22:48:06 -05:00
Brian Curtin e3f3940fc3 file was the old arg name from an earlier patch. command matches the implementation 2012-06-22 21:14:34 -05:00
Alexander Belopolsky de74de5d5d Issue #15148: Fixed typos in shutil.which() docstring 2012-06-22 21:56:42 -04:00
Larry Hastings 9cf065cfdc Issue #14626: Large refactoring of functions / parameters in the os module.
Many functions now support "dir_fd" and "follow_symlinks" parameters;
some also support accepting an open file descriptor in place of of a path
string.  Added os.support_* collections as LBYL helpers.  Removed many
functions only previously seen in 3.3 alpha releases (often starting with
"f" or "l", or ending with "at").  Originally suggested by Serhiy Storchaka;
implemented by Larry Hastings.
2012-06-22 16:30:09 -07:00
Antoine Pitrou 07c24d13ed Issue #444582: shutil.which() respects relative paths. 2012-06-22 23:33:05 +02:00
Brian Curtin 849349de05 whitespace normalize 2012-06-22 16:03:06 -05:00
Brian Curtin c57a34577c Fix #444582. Add shutil.which function for finding programs on the system path. 2012-06-22 16:00:30 -05:00
Brian Curtin 0d0a1dedbc Fix #14772: Return the destination from some shutil functions. 2012-06-18 18:41:07 -05:00
Antoine Pitrou 424246fbf3 Issue #14082: shutil.copy2() now copies extended attributes, if possible.
Patch by Hynek Schlawack.
2012-05-12 19:02:01 +02:00
Ned Deily baf75713c7 Issue #14662: Prevent shutil failures on OS X when destination does not
support chflag operations.  (Patch by Hynek Schlawack)
2012-05-10 17:05:19 -07:00
Larry Hastings b14544807e Issue #14127: Fix no-op stub for platforms that lack some "os" functions. 2012-05-03 12:56:44 -07:00
Larry Hastings 76ad59b7e8 Issue #14127: Add ns= parameter to utime, futimes, and lutimes.
Removed futimens as it is now redundant.
Changed shutil.copystat to use st_atime_ns and st_mtime_ns from os.stat
and ns= parameter to utime--it once again preserves exact metadata on Linux!
2012-05-03 00:30:07 -07:00
Sandro Tosi f8ae4faf93 Issue #14650: fix typo in shutil.disk_usage() docstring; patch by Hobson Lane 2012-04-23 20:07:15 +02:00
Antoine Pitrou bcf2b59fb5 Issue #13609: Add two functions to query the terminal size:
os.get_terminal_size (low level) and shutil.get_terminal_size (high level).
Patch by Zbigniew Jędrzejewski-Szmek.
2012-02-08 23:28:36 +01:00
Éric Araujo cd0d951a70 Merge edits from 3.2 (#13716, #1040439, #2945, #13770, #6715) 2012-02-05 13:49:59 +01:00
Antoine Pitrou 0a08d7a095 Issue #9993: When the source and destination are on different filesystems,
and the source is a symlink, shutil.move() now recreates a symlink on the
destination instead of copying the file contents.
Patch by Jonathan Niehof and Hynek Schlawack.
2012-01-06 20:16:19 +01:00
Antoine Pitrou 78091e63d6 Issue #12715: Add an optional symlinks argument to shutil functions (copyfile, copymode, copystat, copy, copy2).
When that parameter is true, symlinks aren't dereferenced and the operation
instead acts on the symlink itself (or creates one, if relevant).

Patch by Hynek Schlawack.
2011-12-29 18:54:15 +01:00
Florent Xicluna 54540ec917 Remove redundant imports. 2011-11-04 08:29:17 +01:00
Florent Xicluna aabbda5354 Merge 3.2 2011-10-28 14:52:29 +02:00
Éric Araujo c1b7e7f8bb A few style changes originally done in the distutils2 repo 2011-09-18 23:12:30 +02:00
Éric Araujo 0ac4a5d6d2 Add missing name in shutil.__all__ 2011-09-01 08:31:51 +02:00
Sandro Tosi d902a14dd0 #12191: add shutil.chown() to change user and/or group owner of a given path also specifying their names. 2011-08-22 23:28:27 +02:00
Éric Araujo c5efe65df3 Merge 3.2 2011-08-21 14:30:00 +02:00
Éric Araujo 24d6cc6f4f Merge 3.2 2011-08-19 03:19:36 +02:00
Éric Araujo cfcc9779fc Remove unused names in except clauses 2011-08-10 20:54:33 +02:00