RTEMS 14-03-14 tests on CSB336 - SPI SD-card correction etc.

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Mar 31 16:39:57 UTC 2014


On 03/31/2014 04:41 PM, Gedare Bloom wrote:
> On Sun, Mar 30, 2014 at 6:51 PM, Pavel Pisa <ppisa4lists at pikron.com> wrote:
>> Hello Sebastian and others,
>>
>> I have found time to test RTEMS GIT on LPC1788
>> in last days and it works OK. I have tried to
>> run code on CSB336/MXS based platform and I have
>> noticed two problems.
>>
>> The firs is broken filesystem embedding at least
>> on my setup. The embedded untar breaks if directory
>> already exists. And default tar includes './'
>> in archive. Next change/workaround solves the problem
>>
>> diff --git a/cpukit/libmisc/untar/untar.c b/cpukit/libmisc/untar/untar.c
>> index 5f1699d..11a6cc6 100644
>> --- a/cpukit/libmisc/untar/untar.c
>> +++ b/cpukit/libmisc/untar/untar.c
>> @@ -224,6 +224,8 @@ Untar_FromMemory(
>>         else if (linkflag == DIRTYPE)
>>         {
>>            if ( mkdir(fname, S_IRWXU | S_IRWXG | S_IRWXO) != 0 ) {
>> +           if (!strcmp(fname, "/") || !strcmp(fname, "./"))
>> +             continue;
>>              printk("Untar: failed to create directory %s\n", fname);
>>              retval = UNTAR_FAIL;
>>              break;
>>
>> But I think that it should not be solved this way.
>> I expect that  use of stat() libc function to check for directory
>> existence before mkdir attempt is better. If you agree with
>> this solution, I can prepare patch.
>>
> Yes it will be better to check if the directory already exists. Unless
> you can get this info from the return code from mkdir, then using stat
> seems to be appropriate.
> -Gedare

I fixed it on another place with something like this (forgot to commit 
this):

diff --git a/cpukit/libfs/src/imfs/imfs_load_tar.c 
b/cpukit/libfs/src/imfs/imfs_load_tar.c
index fd47ec2..ddf4e45 100644
--- a/cpukit/libfs/src/imfs/imfs_load_tar.c
+++ b/cpukit/libfs/src/imfs/imfs_load_tar.c
@@ -107,6 +107,9 @@ int rtems_tarfs_load(
        ++len;
        strncat(full_filename, filename, 256-len-1);
        rv = mkdir(full_filename, S_IRWXU | S_IRWXG | S_IRWXO);
+      if (rv != 0 && errno == EEXIST) {
+        rv = 0;
+      }
      }
      /*
       * Create a LINEAR_FILE node

The question is why we have also this untar.c.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.




More information about the devel mailing list