From d84e346b26017f021c1a7d5c8ad078c7264240ab Mon Sep 17 00:00:00 2001 From: Chris Johns Date: Thu, 19 May 2016 09:18:21 +1000 Subject: libmisc/untar: Support directory create and overwrites. Share the common code. Support creating directories for files with a path depth greater than 1. Some tar files can have files with a path depth greater than 1 and no directory entry in the tar file to create a directory. Support overwriting existing files and directories failing in a similar way to tar on common hosts. If a file is replaced with a file delete the file and create a new file. If a directory replaces a file remove the file and create the directory. If a file replaces a directory remove the directory, and if the directory is not empty and cannot be removed report an error. If a directory alreday exists do nothing leaving the contents untouched. The untar code now shares the common header parsing and initial processing with the actual writes still separate. No changes to the IMFS have been made. Updates #2415. Closes #2207. --- testsuites/libtests/tar01/init.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'testsuites/libtests/tar01/init.c') diff --git a/testsuites/libtests/tar01/init.c b/testsuites/libtests/tar01/init.c index 8ff107ea04..54760e9e34 100644 --- a/testsuites/libtests/tar01/init.c +++ b/testsuites/libtests/tar01/init.c @@ -44,9 +44,12 @@ void test_cat( void test_untar_from_memory(void) { rtems_status_code sc; + rtems_printer printer; + + rtems_print_printer_printf(&printer); printf("Untaring from memory - "); - sc = Untar_FromMemory((void *)TARFILE_START, TARFILE_SIZE); + sc = Untar_FromMemory_Print((void *)TARFILE_START, TARFILE_SIZE, &printer); if (sc != RTEMS_SUCCESSFUL) { printf ("error: untar failed: %s\n", rtems_status_text (sc)); exit(1); @@ -56,7 +59,7 @@ void test_untar_from_memory(void) /******************/ printf( "========= /home/test_file =========\n" ); test_cat( "/home/test_file", 0, 0 ); - + /******************/ printf( "========= /symlink =========\n" ); test_cat( "/symlink", 0, 0 ); @@ -97,7 +100,7 @@ void test_untar_from_file(void) /******************/ printf( "========= /dest/home/test_file =========\n" ); test_cat( "/dest/home/test_file", 0, 0 ); - + /******************/ printf( "========= /dest/symlink =========\n" ); test_cat( "/dest/symlink", 0, 0 ); -- cgit v1.2.3