Yes, LC_COLLATE=C also works.  I used LC_ALL=C because that was the
only options discussed in sort --help and man.

You can test this by extracting some bits of code from src/doc/Makefile.in:

wspage@linux-24ag:~/fricas> export EXAMPLES='ALIST ARRAY1 ARRAY2
BBTREE BINARY BOP BSTREE CARD CARTEN       CCLASS CHAR CLIF COMPLEX
CONTFRAC CYCLES DECIMAL DERHAM DFLOAT DMP      EQ EQTBL EXIT EXPR
FARRAY FILE FLOAT FNAME FPARFRAC FR FR2 FRAC GBF     GSTBL HEAP
HEXADEC INT INTHEORY KAFILE KERNEL LAZM3PK LEXP LEXTRIPK     LIB LIST
LODO LODO1 LODO2 LPOLY LWORD MAGMA MAPPKG1 MATRIX MKFUNC       MPOLY
MSET NONE OCT ODPOL OP OVAR PERMAN PFR POLY QUAT QUAT2 RADIX
RECLOS REGSET ROMAN SEG SEGBIND SET SINT SQMATRIX SREGSET STBL
 STREAM STRING STRTBL SYMBOL TABLE TEXTFILE UNISEG UP VECTOR VOID
  WUTSET XPBWPOLY XPOLY XPR ZDSOLVE ZLINDEP'

wspage@linux-24ag:~/fricas> (for a in ${EXAMPLES}; do echo $a; done;
sed -n 's/^)abb[a-z]* [a-z][a-z]*  *\([A-Z0-9][A-Z0-9]*\) *\([^
]*\)/\1 \2/p' src/algebra/*.spad.pamphlet ) | sort -k1,1

On my OpenSuSE system this outputs a long list, but notice in
particular the sort order:

...
FIELD Field
FILE
FILECAT FileCategory
FILE File
FINAALG FiniteRankNonAssociativeAlgebra
FINITE Finite
FINRALG FiniteRankAlgebra
FLAGG2 FiniteLinearAggregateFunctions2
FLAGG FiniteLinearAggregate
FLALG FreeLieAlgebra
FLASORT FiniteLinearAggregateSort
FLINEXP FullyLinearlyExplicitRingOver
FLIOUFUN FloatLiouvilianFunctions
FLOAT
FLOATCP FloatingComplexPackage
FLOAT Float
FLOATRP FloatingRealPackage
FM2 FreeModuleFunctions2
FMCAT FreeModuleCategory
FMC FortranMatrixCategory
FM FreeModule
FMFUN FortranMatrixFunctionCategory
FMONOID FreeMonoid
FMTC FortranMachineTypeCategory
FNAME
FNAME FileName
FNCAT FileNameCategory
...

The rest of the script

wspage@linux-24ag:~/fricas> (for a in ${EXAMPLES}; do echo $a; done;
sed -n 's/^)abb[a-z]* [a-z][a-z]*  *\([A-Z0-9][A-Z0-9]*\) *\([^
]*\)/\1 \2/p' src/algebra/*.spad.pamphlet ) | sort -k1 | awk
'{if(a==$1){print};a=$a}' | sort -k2

is intended to pick out only those abbreivations that actually occur
in the EXAMPLES list but the awk filter fails to do this because of
the assumptions it makes about the sort order.

...
EXIT Exit
FR2 FactoredFunctions2
FNAME FileName
FARRAY FlexibleArray
FPARFRAC FullPartialFractionExpansion
QUAT2 GeneralQuaternion
GSTBL GeneralSparseTable
GBF GroebnerFactorizationPackage
HEAP Heap
HEXADEC HexadecimalExpansion
...

Notice in particular that FILE and FLOAT are missing (among many others).

The use of the option LC_ALL=C or LC_COLLATE=C corrects the problem

wspage@linux-24ag:~/fricas> (for a in ${EXAMPLES}; do echo $a; done;
sed -n 's/^)abb[a-z]* [a-z][a-z]*  *\([A-Z0-9][A-Z0-9]*\) *\([^
]*\)/\1 \2/p' src/algebra/*.spad.pamphlet ) | LC_COLLATE=C sort -k1,1
| awk '{if(a==$1){print};a=$a}' | sort -k2

---

The problem appears near the end of in the FriCAS build when
secmenu.awk is called

HTEX2SECMENU  = ${AWK} -f ${srcdir}/secmenu.awk
...
${HD_EXAMPLES_MENU_FILES}: tmp/%.menu: ${htexsrcdir}/%.htex examples.list
        mkdir -p tmp
#       ${HTEX2SECMENU} SRC CHAPTERNUMBER SECTIONNUMBER MENUDIR
        ${HTEX2SECMENU} $< ${EXAMPLES_CHAPTER_NO_LEADING_ZERO} `sed -n
'/^$* /=' examples.list` tmp > $@

This use of sed to construct one of the arguments of secmenu.awk is
very fragile and fails because some expected entries are missing from
the 'examples.list' file that was constructed above.  As a result awk
tries to write a file into the root / directory and fails (assuming
that you are not running this as root)!


On 20 March 2014 09:39, Waldek Hebisch <[email protected]> wrote:
> Ralf Hemmecke wrote:
>> >> ]*\)/\1 \2/p' ${ALGEBRASOURCES}/*.spad.pamphlet\
>> >> -    ) | sort -k1,1 | ${AWK} '{if(a==$$1){print};a=$$a}' | sort -k2 > $@
>> >> +    ) | LC_ALL=C sort -k1,1 | ${AWK} '{if(a==$$1){print};a=$$a}' |
>> >> LC_ALL=C sort -k2 > $@
>> >>
>> >>  xmpexp.ht: examples.list
>> >>      echo '% !! DO NOT MODIFY BY HAND !! It is generated.' > $@
>> >>
>> >> ============
>> >
>> > Does it work when you set just LC_COLLATE?  I am affraid that
>> > if we set LC_ALL=C somebody will be rejecting non-ascii characters.
>> > I think ATM we are pure ASCII, but it would be good to allow
>> > more in the future.
>>
>> I am a bit puzzled. examples.list consists of short and long constructor
>> names. There is nothing else than 7bit. What exact problem did you see?
>>
>> But anyway, it seems, I'd have to check that part of the code again, it
>> looks too complicated.
>
> C orders letters A-Za-z.  IIRC national locales use AaBb...Zz or
> maybe some variation on it.
>
> --
>                               Waldek Hebisch
> [email protected]
>
> --
> You received this message because you are subscribed to the Google Groups 
> "FriCAS - computer algebra system" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/fricas-devel.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to