After installing a crossdev toolchain (i586-unknown-linux-uclibc), 'emerge-wrapper --init' does not correctly detect the toolchain as an x86 ARCH, due to an incorrect logic check. This logic check ( ${chost:3:4} == "86" ) always fails because ${chost:3:4} returns a four character string, and thus is incomparable with the string "86". Furthermore, this is a silent error, and manifests itself by leaving ARCH set to __ARCH__ in the cross compiler toolchain's make.conf, or by changing it to an invalid value (left over from a previous toolchain configuration, such as arm-unknown-linux-uclibc). The error is visible later, as emerging anything with this cross compiler toolchain results in a failure, as portage does not recognize the incorrect ARCH. While fixing the comparison addresses this issue ( ${chost:2:2} == "86" ), it still leaves the tool to fail silently if the user uses a unhandled toolchain. As such, this patch changes the block if statements to a single case statement, with a fall-through case, which will notify the user that something has not gone well. Reproducible: Always Steps to Reproduce: 1. emerge crossdev 2. run " crossdev i586-unknown-linux-uclibc " (takes a while) 3. emerge crossdev-wrappers (or run emerge-wrapper --init) 4. inspect /usr/i586-unknown-linux-uclibc/etc/make.conf, and check ARCH Actual Results: Subsequent emerges using the cross compiler toolchain fail, as ARCH is incorrectly set. Expected Results: Script should set ARCH correctly, at least for known CHOST tuples.
Created attachment 186823 [details, diff] Patch to resolve posed issue
ive never used emerge-wrapper and dont really know what it's for, but your patch looks sane in general, so i've added it http://sources.gentoo.org/gentoo-projects/crossdev-wrappers/emerge-wrapper?r1=1.6&r2=1.7