chmod -R u+w .build/src EACH TIME?????

Thu Mar 3 17:51:00 GMT 2011

Thomas, All,

On Thursday 03 March 2011 09:06:28 Thomas Petazzoni wrote:
> On Wed, 2 Mar 2011 23:35:29 +0100
> "Yann E. MORIN" <> wrote:
> > If so, here are the reasons:
> > - some package do have RO files
> > - so we can apply patches, all files shall be RW
> > - for the C libraries addons (glibc ports, uClibc locales...), we
> >   don't really know where CWD is
> Not sure to understand this point.

When we extract packages, we usually do:
  cd "${src_dir}"
  tar xjf "${tarball}"

This works OK for most packages, except for the C library addons, which
must be extracted inside the top-level of the C library, as:
  cd "${src_dir}"
  tar xjf "${glibc_tarball}"
  cd glibc-x.yy
  tar xjf "${glibc_ports_tarball}"

Extraction is currently implemented in crostool-NG as a helper function
that takes one or two args:
  CT_Extract <basename> [nochdir]
  - basename is the base name of the archive, without the extension, (eg.
    glibc-2.9, and CT_Extract will find the proper extension (.tar, .tgz,
    .tar.bz2, .zip...)
  - if $2 = "nochdir", CT_Extract will just extract the tarball in CWD.

Also, tarballs will not necessarilly extract a directory named after the
tarball base name. For example:
  tarball                  | Expected dir      | Actual dir
  cloog-ppl-0.15.3.tar.bz2 | cloog-ppl-0.15.3/ | cloog-ppl/
  glibc-ports-2.9.tar.bz2  | ports/            | glibc-ports-2.9/ or ports/

So, from the generic handler CT_Extract, we can't know what directory we
should chmod.

Because addons could well overwrite existing files, we have to have all
files RW before we extract a new tarball. To apply patches, we need to
have all files RW as well.

So, the only trivial-to-implement way I thought of at the time was to
simply chmod the whole "${src_dir}" after each tarball was extracted.

Yes, this is a killer. :-(

> > - some package does not extract in a sub-directory of their base name
> >   ( eg. cloog-ppl 0.15.3 extracts into cloog-ppl/ )
> This you can solve this --strip-components in tar.

Yes, that's a good ides. This has the side effect of making all directory
properly named.

But after a little bit of thinking, I think I prefer that the offending
package(s) do their own cleanup, rather than every one suffering...

> In Buildroot, we don't need to chmod anything special, why would it be
> needed to ct-ng ?

For example, ncurses-5.7, used to build the native gdb to run on the target,
has all its files read-only. Granted, 5.8 is out, and the archive has all
files RW, but crosstool-NG still uses 5.7.

Yann E. MORIN.

|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |

For unsubscribe information see

More information about the crossgcc mailing list