#2413 closed defect (fixed)
Untar_FromMemory breaks on create directory if they exists, even on root one.
Reported by: | Pavel Pisa | Owned by: | Pavel Pisa <pisa@…> |
---|---|---|---|
Priority: | normal | Milestone: | 4.11 |
Component: | unspecified | Version: | 4.11 |
Severity: | normal | Keywords: | |
Cc: | Blocked By: | ||
Blocking: |
Description
When directory specified by TAR file already exists then Untar_FromMemory bails out with error EEXIST (File exists).
Untar: failed to create directory ./ Untar_FromMemory returned RTEMS_TASK_EXITTED
Because TAR includes "./" directory in archive by default and IMFS includes root directory, UNTAR fails for standard configurations.
Attachments (1)
Change History (5)
comment:1 Changed on 09/07/15 at 09:13:15 by Pavel Pisa
Changed on 11/11/15 at 13:44:15 by Pavel Pisa
Attachment: | 0001-untar-do-not-exit-with-error-when-created-directory-.patch added |
---|
comment:2 Changed on 11/18/15 at 22:14:28 by Chris Johns
I do not think the patch is enough. For example on OS X:
$ rm -rf x && mkdir x && mkdir x/1 && touch x/1/1 touch x/2 && tar cf t1.tar x $ rm -rf x && mkdir x && mkdir x/2 && touch x/2/1 touch x/1 && tar cf t2.tar x $ rm -rf x && tar xf t1.tar && tar xf t2.tar x/1: Can't remove already-existing dir tar: Error exit delayed from previous errors.
and on FreeBSD:
$ rm -rf x && mkdir x && mkdir x/1 && touch x/1/1 touch x/2 && tar cf t1.tar x $ rm -rf x && mkdir x && mkdir x/2 && touch x/2/1 touch x/1 && tar cf t2.tar x $ rm -rf x && tar xf t1.tar && tar xf t2.tar x/1: Can't replace existing directory with non-directory tar: Error exit delayed from previous errors.
I think we need to add more checking and error if nodes are not the same. I cannot see a way around this.
The current implementation is overly cautious and it has made me move away a direction and untar a fresh image. In the end I think it is better as stray files do not hang around. I would rather we handle the special cases correctly or not at all.
comment:3 Changed on 11/23/15 at 15:40:35 by Pavel Pisa <pisa@…>
Owner: | set to Pavel Pisa <pisa@…> |
---|---|
Resolution: | → fixed |
Status: | new → closed |
comment:4 Changed on 11/23/15 at 15:40:47 by Pavel Pisa <pisa@…>
Note: See
TracTickets for help on using
tickets.
Simple workaround is to ignore EEXIST for directory create (mkdir).
Alternative providing more strict checking with stat call