[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [urgent] update-fontlang new checks



Norbert Preining <preining@logic.at> wrote:

> Yes it does. Use kpsewhich ...

But there are zillions of paths for the zillions of possible uses
(kpsewhich '-format=web2c files', etc.)...

>> > +            if [ -r "$d/$PATH_COMPONENT/$DEFAULT_OUTPUTFILE_BASENAME" ]; then
>> 
>>                  or -f...
>
> What would you suggest, oh my POSIX guru ;-)???

;-)

Nothing to do with POSIX, but I prefer -f. That's because if there is a
file in such a place, be it readable or not, it's a bit weird, so I
think the user should be warned. But this is not very important...

> I remotely remember that I learned this from you after having used echo
> for these things ...

Well, echo is OK as long as you call it with no option nor use any
escape sequence. In all other cases, printf is a better alternative.
But don't bother. Your printf is perfectly correct here.

(what I probably told you that you are vaguely remembering, is to
replace "echo -n" with printf)

> Now for the new stuff: I have moved the whole bunch out as Ralf
> suggested. It comes now after the sanity checks, so this should happen
> in any case.

OK...

> But there is one more problem I haven't solved, and I am not sure if we
> should hurry to find the perfect solution for this: If the user sets the
> output_dir to the file in .texmf_config/.... then we might warn in case
> even if this is a vain warning. 

I see.

> Although, people calling update-* with output file set via cmd-line
> should know that this might not be true, or?

Well, probably, but they could find the message confusing.

> I at least included a check for the most simple case, where the files
> are actually the same.

What I would probably do:

--- /sid-root/home/flo/debian-tex/tex-common/trunk/scripts/update-fontlang	2006-10-07 14:40:40.000000000 +0200
+++ /tmp/update-fontlang.new	2006-10-10 01:15:23.000000000 +0200
@@ -382,6 +382,8 @@
 # ****************************************************************************
 quiet=1
 dochecks=0
+output_file_specified=0
+
 if [ $syswide_mode = 1 ]; then
     output_file="$SYSWIDE_DEFAULT_OUTPUTFILE"
 else
@@ -424,7 +426,10 @@
 while true; do
     case "$1" in
         -c|--conf-dir) conf_dir="$2"; shift 2 ;;
-        -o|--output-file) output_file="$2"; shift 2 ;;
+        -o|--output-file)
+            output_file_specified=1
+            output_file="$2"
+            shift 2 ;;
         --quiet) quiet=1; shift ;;
         --check) dochecks=1; shift ;;
         -v) printf "\

and then, use:

if [ $syswide_mode = 0 ] && [ $output_file_specified = 0 ]; then

  [...]

fi

around the check we are discussing.

Rationale: when the output file is explicitely given, the user is
supposed to know what he's doing, dammit! In all other cases, the
warning should be appropriate (not "vain", as you put it).

> Please comment:
>
> @@ -473,6 +478,31 @@
>  
>  perform_sanity_checks

I believe this code could actually enter perform_sanity_checks.
  
> +
> +# it could be that there is a DEFAULT_OUTPUTFILE_BASENAME file 
> +# in TEXMFCONFIG, which would be found instead of the
> +# output_file. So we check for this and give a warning in case
> +# the created file would be shadowed.
> +if [ $syswide_mode = 0 ]; then
> +    OLDIFS="$IFS"
> +    IFS=:
> +    for d in "$texmfconfig"; do
> +        if [ ! "$d/$PATH_COMPONENT/$DEFAULT_OUTPUTFILE_BASENAME" = "$output_file" ] && [ -r "$d/$PATH_COMPONENT/$DEFAULT_OUTPUTFILE_BASENAME" ] ; then

Should work in most cases...

> +            printf "\
> +You are about to generate the file 
> +        $output_file
> +but at the same time you have a file
> +        $d/$PATH_COMPONENT/$DEFAULT_OUTPUTFILE_BASENAME
> +which will shadow the former one. We'll continue generating the first
                                ^^^
I don't think this is correct...

> +file, but to allow TeX and friends to find it, you'll have to remove the
> +second one.\n"
> +            # don't break out as we want to warn the user for *every*
> +            # shadowing file!
> +        fi
> +    done
> +    IFS="$OLDIFS"
> +fi

'kay.

-- 
Florent



Reply to: