You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Helmut M. (JIRA)" <ji...@apache.org> on 2010/10/11 15:31:33 UTC
[jira] Created: (COMPRESS-120) forbidden chars on windows
forbidden chars on windows
--------------------------
Key: COMPRESS-120
URL: https://issues.apache.org/jira/browse/COMPRESS-120
Project: Commons Compress
Issue Type: Improvement
Components: Archivers
Affects Versions: 1.0
Environment: WindowsXP32bit
Reporter: Helmut M.
Priority: Minor
while uncompressing a tar archive, which includes files and directories containing special characters like
private char[] forbiddenCharsWindows = new char[] { ':', '*', '?', '"', '<', '>', '|' }; the name of the tarEntry is corrupt
and to create the directory or file is not possible. Exceptions occurs while creating them.
it would be better to replace them with '_' instead to respond invalid entrynames.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (COMPRESS-120) forbidden chars on windows
Posted by "Helmut Minst (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COMPRESS-120?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12920549#action_12920549 ]
Helmut Minst commented on COMPRESS-120:
---------------------------------------
if the data to extract is confidential, it might be forbidden to change the filenames by default.
it would be nice to provide a method just like ArchiveInputStream#replaceInvalidCharacters(Character replacement)
to switch the behaviour on and off
in TarArchiveInputStream#getNextTarEntry() just react on the String replacement.
String tmpNameString = currEntry.getName();
for (char forbidden : forbiddenChars) {
tmpNameString = tmpNameString.replace(forbidden, '_');
}
currEntry.setName(tmpNameString);
forbiddenChars may be different on different OS, so there must be a decision where
the application runs on
analog to this, every nextEntry in other streams such as zip, jar... must reacted.
the best way might be to implement this replacement in the parent class
@Sebb: "However, a Windows-specific filename "cleaning" method would potentially be useful.
The code could potentially also be useful as part of Commons IO?"
yes, if there would be an easy to use method (callable in a static way), the consumer may react on the filename or not.
> forbidden chars on windows
> --------------------------
>
> Key: COMPRESS-120
> URL: https://issues.apache.org/jira/browse/COMPRESS-120
> Project: Commons Compress
> Issue Type: Improvement
> Components: Archivers
> Affects Versions: 1.0
> Environment: WindowsXP32bit
> Reporter: Helmut Minst
> Priority: Minor
>
> while uncompressing a tar archive, which includes files and directories containing special characters like
> private char[] forbiddenCharsWindows = new char[] { ':', '*', '?', '"', '<', '>', '|' }; the name of the tarEntry is corrupt
> and to create the directory or file is not possible. Exceptions occurs while creating them.
> it would be better to replace them with '_' instead to respond invalid entrynames.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (COMPRESS-120) forbidden chars on windows
Posted by "Torsten Curdt (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COMPRESS-120?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Torsten Curdt closed COMPRESS-120.
----------------------------------
Resolution: Not A Problem
If you want to filter the names before extraction do so by wrapping the call to the name
String safeName = filter(entry.getName())
IMO this is out of the scope of commons compress so closing this issue.
> forbidden chars on windows
> --------------------------
>
> Key: COMPRESS-120
> URL: https://issues.apache.org/jira/browse/COMPRESS-120
> Project: Commons Compress
> Issue Type: Improvement
> Components: Archivers
> Affects Versions: 1.0
> Environment: WindowsXP32bit
> Reporter: Helmut Minst
> Priority: Minor
>
> while uncompressing a tar archive, which includes files and directories containing special characters like
> private char[] forbiddenCharsWindows = new char[] { ':', '*', '?', '"', '<', '>', '|' }; the name of the tarEntry is corrupt
> and to create the directory or file is not possible. Exceptions occurs while creating them.
> it would be better to replace them with '_' instead to respond invalid entrynames.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (COMPRESS-120) forbidden chars on windows
Posted by "Emmanuel Bourg (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COMPRESS-120?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12920515#action_12920515 ]
Emmanuel Bourg commented on COMPRESS-120:
-----------------------------------------
That's correct, I just realized the API doesn't contain a higher level method to decompress an archive to a directory. Handling these cases will only be required if COMPRESS-118 is implemented.
> forbidden chars on windows
> --------------------------
>
> Key: COMPRESS-120
> URL: https://issues.apache.org/jira/browse/COMPRESS-120
> Project: Commons Compress
> Issue Type: Improvement
> Components: Archivers
> Affects Versions: 1.0
> Environment: WindowsXP32bit
> Reporter: Helmut M.
> Priority: Minor
>
> while uncompressing a tar archive, which includes files and directories containing special characters like
> private char[] forbiddenCharsWindows = new char[] { ':', '*', '?', '"', '<', '>', '|' }; the name of the tarEntry is corrupt
> and to create the directory or file is not possible. Exceptions occurs while creating them.
> it would be better to replace them with '_' instead to respond invalid entrynames.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (COMPRESS-120) forbidden chars on windows
Posted by "Jochen Wiedmann (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COMPRESS-120?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12920566#action_12920566 ]
Jochen Wiedmann commented on COMPRESS-120:
------------------------------------------
I think that silently replacing characters by default is a very bad idea, at least in a programmatic API like Commons Compress. Admittedly, command line tools like WinRAR, or 7-zip are a different matter.
If I extract an archive programmatically, I expect the extracted contents to be identical, not similar. In other words, if there are any invalid characters, then the only sensible approach *by default* is to throw an IOException or something similar.
If the user *knows* that he wants to replace characters, then we might provide an implementation of an interface like FileNameReplacer, or something similar. In my opinion, the default implementation of FileNameReplacer is what would throw the IOException.
> forbidden chars on windows
> --------------------------
>
> Key: COMPRESS-120
> URL: https://issues.apache.org/jira/browse/COMPRESS-120
> Project: Commons Compress
> Issue Type: Improvement
> Components: Archivers
> Affects Versions: 1.0
> Environment: WindowsXP32bit
> Reporter: Helmut Minst
> Priority: Minor
>
> while uncompressing a tar archive, which includes files and directories containing special characters like
> private char[] forbiddenCharsWindows = new char[] { ':', '*', '?', '"', '<', '>', '|' }; the name of the tarEntry is corrupt
> and to create the directory or file is not possible. Exceptions occurs while creating them.
> it would be better to replace them with '_' instead to respond invalid entrynames.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (COMPRESS-120) forbidden chars on windows
Posted by "Emmanuel Bourg (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COMPRESS-120?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12920500#action_12920500 ]
Emmanuel Bourg commented on COMPRESS-120:
-----------------------------------------
Replacing invalid characters with '_' sounds sensible, that's the behavior of archive utilities likes WinRAR or 7-Zip. There are other restrictions on Windows that should be considered, like the files using a device name (for example it's impossible to create a file named aux.txt). The details are available at http://msdn.microsoft.com/en-us/library/Aa365247
> forbidden chars on windows
> --------------------------
>
> Key: COMPRESS-120
> URL: https://issues.apache.org/jira/browse/COMPRESS-120
> Project: Commons Compress
> Issue Type: Improvement
> Components: Archivers
> Affects Versions: 1.0
> Environment: WindowsXP32bit
> Reporter: Helmut M.
> Priority: Minor
>
> while uncompressing a tar archive, which includes files and directories containing special characters like
> private char[] forbiddenCharsWindows = new char[] { ':', '*', '?', '"', '<', '>', '|' }; the name of the tarEntry is corrupt
> and to create the directory or file is not possible. Exceptions occurs while creating them.
> it would be better to replace them with '_' instead to respond invalid entrynames.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (COMPRESS-120) forbidden chars on windows
Posted by "Torsten Curdt (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COMPRESS-120?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12920502#action_12920502 ]
Torsten Curdt commented on COMPRESS-120:
----------------------------------------
But it's that what the developer using compress should be doing? ....or what am I missing here?
> forbidden chars on windows
> --------------------------
>
> Key: COMPRESS-120
> URL: https://issues.apache.org/jira/browse/COMPRESS-120
> Project: Commons Compress
> Issue Type: Improvement
> Components: Archivers
> Affects Versions: 1.0
> Environment: WindowsXP32bit
> Reporter: Helmut M.
> Priority: Minor
>
> while uncompressing a tar archive, which includes files and directories containing special characters like
> private char[] forbiddenCharsWindows = new char[] { ':', '*', '?', '"', '<', '>', '|' }; the name of the tarEntry is corrupt
> and to create the directory or file is not possible. Exceptions occurs while creating them.
> it would be better to replace them with '_' instead to respond invalid entrynames.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (COMPRESS-120) forbidden chars on windows
Posted by "Sebb (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COMPRESS-120?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12920535#action_12920535 ]
Sebb commented on COMPRESS-120:
-------------------------------
The invalid characters and filenames obviously depend on the OS, so the code would need to either be configurable, or autodetect the host OS.
Also, note that some Java implementations (or host OSes) may automatically convert invalid characters.
For example, OpenVMS converts aux><txt to aux__txt. Unix allows everything except NUL and /.
However, a Windows-specific filename "cleaning" method would potentially be useful.
The code could potentially also be useful as part of Commons IO?
> forbidden chars on windows
> --------------------------
>
> Key: COMPRESS-120
> URL: https://issues.apache.org/jira/browse/COMPRESS-120
> Project: Commons Compress
> Issue Type: Improvement
> Components: Archivers
> Affects Versions: 1.0
> Environment: WindowsXP32bit
> Reporter: Helmut M.
> Priority: Minor
>
> while uncompressing a tar archive, which includes files and directories containing special characters like
> private char[] forbiddenCharsWindows = new char[] { ':', '*', '?', '"', '<', '>', '|' }; the name of the tarEntry is corrupt
> and to create the directory or file is not possible. Exceptions occurs while creating them.
> it would be better to replace them with '_' instead to respond invalid entrynames.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.