Installation of a custom plugin fails on linux with different partitions / file systems
See original GitHub issueExpected Behavior
dita --install plugin.zip should install a new plugin
Actual Behavior
On linux with several partitions / file systems (/tmp and /home are separated) the command above fails with the following exemplary error message:
Error: /tmp/2913888489706122428/plugin/com.scoop-software.plugin
The class PluginInstallTask tries to move a nonempty directory
Files.move(tempPluginDir.toPath(), pluginDir.toPath());
what does not work if the source and the target are located on different partitions
Possible Solution
I’ve replaced the Files.move line with the following code:
Files.walkFileTree(tempPluginDir.toPath(), new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
Path targetPath = pluginDir.toPath().resolve(tempPluginDir.toPath().relativize(dir));
if(!Files.exists(targetPath)) {
Files.createDirectory(targetPath);
}
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
Files.copy(file, pluginDir.toPath().resolve(tempPluginDir.toPath().relativize(file)));
return FileVisitResult.CONTINUE;
}
});
which fixes the problem on my linux server (and also works on my Windows 10 PC)
Steps to Reproduce
A linux server with two different partitions is needed
- Create a new folder on the first partition. Create a file in it
- Adopt the paths in the following class. The second path has to point to a different (second) partition
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
public class MoveFailure {
private static final String tempDir = "/tmp/plugin";
private static final String homeDir = "/home/user/plugin";
public static void main(String[] args) throws IOException {
final File tempPluginDir = new File(tempDir);
final File pluginDir = new File(homeDir);
Files.move(tempPluginDir.toPath(), pluginDir.toPath());
}
}
- Run the class using java. It results in:
Exception in thread "main" java.nio.file.DirectoryNotEmptyException: /tmp/plugin
at sun.nio.fs.UnixCopyFile.move(UnixCopyFile.java:498)
at sun.nio.fs.UnixFileSystemProvider.move(UnixFileSystemProvider.java:262)
at java.nio.file.Files.move(Files.java:1395)
at TestMove.main(TestMove.java:17)
Copy of the error message, log file or stack trace
java.nio.file.DirectoryNotEmptyException: /tmp/2913888489706122428/plugin/com.scoop-software.plugin
at sun.nio.fs.UnixCopyFile.move(UnixCopyFile.java:498)
at sun.nio.fs.UnixFileSystemProvider.move(UnixFileSystemProvider.java:262)
at java.nio.file.Files.move(Files.java:1395)
at org.dita.dost.ant.PluginInstallTask.execute(PluginInstallTask.java:133)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
...
Environment
- DITA-OT version: 3.2
- Operating system and version: Linux (SLES 11.4)
- How did you run DITA-OT:
dita
command - Transformation type: custom (based on PDF)
Issue Analytics
- State:
- Created 5 years ago
- Comments:6
Top Results From Across the Web
eeexubuntu file system error during installation - creating ext2 ...
ISSUE RESOLVED-NO FURTHER HELP NEEDED-THANKS Error creating partition installing eeexubuntu... I'm getting the error "File system was not ...
Read more >14.2. Trouble During the Installation Red Hat Enterprise Linux 7
If you create partitions manually, but cannot move to the next screen, you probably have not created all the partitions necessary for installation...
Read more >File systems - ArchWiki
Individual drive partitions can be set up using one of the many different available file systems. Each has its own advantages, disadvantages ...
Read more >Creating a disk partition in Linux - Fedora Documentation
Partitioning is particularly useful if you run multiple operating systems. ... Partition Table: msdos Disk Flags: Number Start End Size Type File system...
Read more >File System - Rocky Linux Documentation
Partitioning will allow the installation of several operating systems because ... The mkfs command allows you to create a Linux file system.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Affects me too. Because of this we are no longer able to install our plugin.
A fix is needed in order to update to 3.2.1 …
@hcw70 I submitted a pull request (#3238)