Commit Graph

224 Commits

Author SHA1 Message Date
Jesse Glick adc218825d FilePath.read should rethrow any FileNotFoundException, SecurityException, etc. 2014-10-15 16:36:12 -04:00
Jesse Glick 698858fd92 Changes in remoting make wrapping IOException less necessary.
Still do it so we capture FilePath.remote (which many JRE methods suppress),
but fix the wrapper Throwable.message to include cause.toString() according to convention.
2014-10-15 16:12:10 -04:00
Kohsuke Kawaguchi 4f733244e6 Moving MasterToSlaveFileCallable/SlaveToMasterFileCallable to the top level classes.
If we ever decide to develop a compatibility thunk library for these changes to help promote deployment in plugins,
then these classes being a nested type is problematic as they'll fail to load under onld Jenkins
2014-09-24 19:04:24 -07:00
Kohsuke Kawaguchi 201b035cfc Updated to reflect the signature change around role checking in remoting 2014-09-24 09:43:31 -07:00
Kohsuke Kawaguchi ffb5b65093 Switched from annotation based scheme to a function based scheme. 2014-09-23 19:12:43 -07:00
Kohsuke Kawaguchi 140d929516 Fixed the computation of effective FilePathFilter.
If a @SlaveToMaster Callable gets sent to the master, and if inside its call() method the code directly/indirectly performs file system access (for example on files and directories that it didn't receive as parameters), that is not meant to be the subject of the filter check.

Rather, the check is meant for FilePath that the other side sends to us, when it points to a local file.

So it makes more sense to compute the effective FilePathFilter during the deserialization, as opposed to doing so when the actual operation is attempted.

Various FileCallable impls in FilePath fits this pattern, as it drags outer FilePath instance with itself. In addition, this change addresses other situations correctly, where FilePath is used as arguments and return values of other Callables, such as the following:

FilePath f = channel.call(new SlaveWillDoSomeComputationAndGiveMeTheResultAsFile());
f.copyTo(build.getRootDir().child("data.xml"))

"f.copyTo" happens in the context of Channel.current()==null, but we need to check that 'f' is legit and not something like
new FilePath(new File("/etc/shadow"))
2014-09-23 14:53:31 -07:00
Kohsuke Kawaguchi c0260056e5 in pre-cursor for the next change, make all remoting call go through FileCallable 2014-09-23 14:53:31 -07:00
Jesse Glick 735ba83148 Installing a default FilePathFilter that rejects everything. 2014-09-22 12:54:05 -04:00
Jesse Glick 4fabe92368 One-letter typo caused massive test failures, obscuring any real problems. 2014-09-20 15:44:12 -04:00
Kohsuke Kawaguchi 7bd7e4f0b2 Fix up.
- If a write results in a file creation, do the create check, to align with the POSIX semantics.
- Don't make pointless mkdirs check if the directory already exists
- read vs readSymlink difference is dangerous because read() can be called for symlinks in other context as well.
2014-09-18 18:52:05 -07:00
Kohsuke Kawaguchi e4a1ac2ba1 Added a hook to intercept remote file access and reject them if necessary 2014-09-18 18:40:56 -07:00
Kohsuke Kawaguchi 101b4e7fd5 [SECURITY-144] Classify all the core callables one way or the other 2014-09-18 15:07:31 -07:00
Kohsuke Kawaguchi 7ec8787122 Wrong target 2013-09-13 12:54:53 -07:00
Kohsuke Kawaguchi bb848952e3 More doc improvements 2013-09-13 12:30:07 -07:00
Kohsuke Kawaguchi f60b631a8a targeting to 1.531 2013-09-13 12:16:34 -07:00
Kohsuke Kawaguchi d3a13f46e6 making the method more discoverable by having an instance method 2013-09-13 12:00:22 -07:00
Jesse Glick b74750934c Merge branch 'master' into ArtifactManager-JENKINS-17236
Conflicts:
	core/src/main/java/hudson/FilePath.java
	core/src/main/java/hudson/tasks/ArtifactArchiver.java
2013-09-12 07:57:32 -04:00
Jesse Glick b02d45737e [FIXED JENKINS-19473] Trying to work around jzlib bug. 2013-09-11 17:45:10 -04:00
Jesse Glick 574fe1409e [FIXED JENKINS-9540] Failure of recursive copy on slave side should be reported.
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.)
2013-08-29 16:13:48 -04:00
Jesse Glick 851b2d938b Making ExplicitlySpecifiedDirScanner public since it can be useful for other artifact managers. 2013-08-21 11:22:35 -04:00
Jesse Glick 957595d2b4 You might expect new FilePath(null, "/local/path").getChannel() to be null.
Confusingly, it is instead MasterComputer.localChannel!
If that is fed back into FilePath.<init>(VirtualChannel,String) rather than using .<init>(FilePath,String)
you get an object that behaves strangely and throws exceptions.
2013-08-19 16:19:20 -04:00
Jesse Glick 920c3fde33 A DirScanner must be serializable. 2013-08-13 13:04:52 -04:00
Jesse Glick 2e09239906 Java 5 compatibility. 2013-08-12 19:08:11 -04:00
Jesse Glick ee4455d3ea Reworked ArtifactManager.archive to take a Map<String,String> to allow more flexible archiving behaviors. 2013-08-12 18:03:52 -04:00
Jesse Glick 902a0747f3 Emphasizing that FileCallable should not be an inner class. 2013-08-01 15:59:01 -04:00
ssogabe 26f913baaa make sure to close writer 2013-07-28 01:28:44 +09:00
ssogabe e4ea2fa75c fixed Compilation failure 2013-07-27 17:06:36 +09:00
Kohsuke Kawaguchi c462cb634c added a convenience method 2013-07-26 21:02:13 -07:00
Jesse Glick 11953750ab [[JENKINS-16301] Use a buffered input stream to get somewhat better performance also from Maven archiving.
Introducing Util.getDigestOf(File) as a convenience.
2013-07-24 16:30:48 -04:00
Kohsuke Kawaguchi 735713801b [FIXED JENKINS-18438]
Node monitoring should run in parallel to reduce the total round-trip
time in large instances.
2013-06-26 16:29:43 -07:00
Jesse Glick b7e2d6127f Merge branch 'master' into JENKINS-14362-jzlib
Conflicts:
	core/pom.xml
2013-06-19 08:36:03 -04:00
Jesse Glick 7f966f6f31 [FIXED JENKINS-18351] Better fix for file handle leak. 2013-06-14 18:11:14 -04:00
Christoph Kutzinski 93c31be1b7 [FIXED JENKINS-18351] file descriptor leak while fingerprinting 2013-06-14 18:36:08 +02:00
Jesse Glick dedb24ef03 Merge branch 'master' into JENKINS-14362-jzlib 2013-06-11 08:00:27 -04:00
Jesse Glick b1c82f1e30 stephenc asks to use TODO rather than XXX 2013-06-10 11:53:13 -04:00
Jesse Glick 3701a327a7 [JENKINS-14362] Switch to jzlib for GZIP streaming. 2013-06-03 14:20:35 -04:00
Jesse Glick 9d72311ba0 [JENKINS-16301] Use a buffered input stream to get somewhat better performance. 2013-05-21 17:42:50 -04:00
Jesse Glick b67272e726 [FIXED JENKINS-17330] FilePath.installIfNecessaryFrom should avoid routing download over remoting channel. 2013-03-27 19:11:06 -04:00
Christoph Kutzinski b807845b9b Added serialVersionUID to all Callables 2013-01-20 13:48:02 +01:00
Christoph Kutzinski 19b31687c8 [JENKINS-16215] : changelog 2013-01-20 13:40:54 +01:00
Lars Hvile 35f7653b7b [JENKINS-16215] Avoiding unnecessary downloads in FilePath.installIfNecessaryFrom.
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.
2012-12-28 14:43:41 +01:00
Jesse Glick 9005275457 Documenting previously undeclared PosixException from mode(). 2012-11-05 15:55:31 -05:00
Jesse Glick a885cc2179 [FIXED JENKINS-7214] FilePath.validateAntFileMask too slow for /configure. 2012-09-19 16:43:20 -04:00
wolfgarnet 6b056fa0ab Added callable wrapper to actAsync 2012-09-12 16:04:49 +02:00
Nicolas De loof 020e46b28b Update core/src/main/java/hudson/FilePath.java
make AbstractInterceptorCallableWrapper a static inner class for usability in plugins
2012-09-12 14:36:11 +03:00
Nicolas De Loof 8b15fb6ae7 null check to avoid unit test failure 2012-09-11 15:19:11 +02:00
Nicolas De loof c47fcd868a Update core/src/main/java/hudson/FilePath.java
fix confusion in my french-to-english buggy translator :P
2012-09-07 16:50:04 +03:00
Nicolas De Loof 299e3d5700 Extension don't need to extend AbstractDescribableImpl 2012-09-06 21:43:36 +02:00
Nicolas De Loof a0f6f49f5c add some javadoc links and @since 2012-09-06 16:29:50 +02:00
Nicolas De Loof 3e596c9463 don't unnecessary expose callable 2012-09-06 16:27:11 +02:00