* JENKINS-13128: Preserve copied file permissions and mtime
This fixes a bug where files copied locally do not preserve file permissions or last modification time.
* Use IO utility methods for exception handling
* Fix invalid path exception propagation
* Revert hudson.Util
* Use "Files.createTempDirectory" to create temp directory instead
See SonarQube critical vulnerability squid:S2976 (tag: owasp-a9)
https://next.sonarqube.com/sonarqube/coding_rules#rule_key=squid%3AS2976
* [JENKINS-48227]
Creating a utility "static Path toPath(File file) throws IOException" method,
which wraps InvalidPathException to IOException so that it will be checked.
- also fixed public static final reference
- fixed broken test cases
- added new test cases for toPath() and createTempDir()
* Revert back to public static int
* adjustments due to merges
* Add posix check to determine if Posix FileAttributes should be included
in call to Files.createTempDirectory()
* Remove reference to private element
* Updated to use explicit imports
* Use NIO for FilePath#chmod and IOUtils#mode
* Add tests for NIO mode and chmod implementations
* Add test, remove new method, and update JavaDoc
* Provide system property to use native implementations of chmod and mode
* Revert unrelated whitespace modification
* Don't remove exception from throws and put imports in original location
* Fix broken JavaDoc links
* Ignore file type bits (above 0o7777) in Util#modeToPermission
* Use octal for constants and don't include file type bits
* Revert unnecessary changes to TarArchiverTest
* Add assertion that non-permission bits are ignored by chmod
* Use NIO copy with StandardCopyOption.COPY_ATTRIBUTES in copyToWithPermissions where possible
* Catch InvalidPathException and convert it to IOException
* Create utility method for File#toPath and use File#createDirectories after review
* Remove useless calls to toAbsolutePath and getAbsoluteFile
* Fix typos and use octal for constant after review
* Add test for behavior of copyToWithPermission with special bits
* Always use NIO to detect symlinks
* Make assertion failure message consistent
* Catch NoSuchFileException to keep tests passing
* Make method name more specific and simlify assumption
* Remove obsolete comment and reword the main comment in isSymlink
* Deprecate Kernel32Util#isJunctionOrSymlink
* Use assumptions for junction creation and add messages to assumptions
* Replace deprecated code with recommended alternative
* Add comment explaining call to DosFileAttributes#isOther
* Do not fall back to native code when creating symlinks
* Log FileSystemExceptions when creating symbolic links
* Catch InvalidPathException and rethrow as IOException
* Deprecate Kernel32Utils#createSymbolicLink and #getWin32FileAttributes
* Preserve original logging behavior on Windows and remove useless call to Util#displayIOException
Not fully solved, since the scannedDirs field can still grow to be large, but at least clearing files/dirsNotIncluded.
Also imposing a 5s timeout on the scan regardless of file count, and defining a user-customizable bound.
Instead it was being thrown in a Future that the master did not wait for:
the writing side failed with a closed pipe exception, and this meaningless error was thrown up.
Fixing by waiting for the reading side first, so any error there will be thrown up.
(If there was _also_ an error on the writing side, we would miss it, but typically this will just be the closed stream.)
FilePath#moveAllChildrenTo faild,
when same name directory exist.
change Void to void, recursive_invoke is internal helper function.
thanks review by jglick
The updated version uses the locally cached timestamp, '.timestamp', to set the
'If-Modified-Since' header. 304 Not Modified responses are dealt with by
aborting the installation.
Previously, the untar code tries to set the last modified time and mode
on every untarred file. However, if the tar contains a broken symlink,
or a symlink that points to a file that has not been untarred yet, the
time/mode setting would fail on the broken symlink.
Symlinks don't have meaningful modified times or modes of their own, so
only set these values on non-symlinks.
Rename the file "a" in the test to expose the bug.
(not "."), and handle edge case so path with no parent ("/" or "abc")
returns null instead of getting IndexOutOfBoundsException.
(returning null is consistent with File.getParentFile())
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@30917 71c3de6d-444a-0410-be80-ed276b4c234a
Add setOverwrite(true) for local->local copy in FilePath.copyRecursiveTo().
This makes it consistent with master/slave copy (either direction),
and also avoids returning 0 if all files already have current/newer timestamp
which some code (javadoc publishing, copyartifact plugin) would interpret as
copy failure or no matching files found.
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@30450 71c3de6d-444a-0410-be80-ed276b4c234a