Date:2010-08-29 08:41:54 (9 years 19 days ago)
Author:Werner Almesberger
Commit:cfbdd4532333f1851e0f4dd71cb54f7aebd05e6c
Message:Despite trying to be careful with quoting, some spaces in file names still did upset things.

- scripts/schhist2web: backticks in command invocation need quoting
- scripts/schhist2web: the change below needs a bashism, so we switch from
/bin/sh to /bin/bash
- scripts/schhist2web: seems that there's no safe way to use ls -1 in the
word list of "for". Use while read ...; ... done < <(ls -1) instead.
(We couldn't just pipe this into the while loop, because that would put
the loop into a subshell and changes to global variables would thus be
lost.)
Files: scripts/schhist2web (7 diffs)

Change Details

scripts/schhist2web
1#!/bin/sh
1#!/bin/bash
22#
33# schhist2web - Web-browseable graphical revision history of schematics
44#
...... 
208208    if [ ! -z "$head" ]; then
209209        prev="$cache/ppm_$head"/`basename "$m"`
210210        if [ -r "$prev" ] && cmp -s "$prev" "$m"; then
211        symlink "../ppm_$head"/`basename "$m"` "$m"
212        symlink "../fat_$head"/`basename "$m"` \
213          "$cache/fat_$n"/`basename "$m"`
211        symlink "../ppm_$head/`basename \"$m\"`" "$m"
212        symlink "../fat_$head/`basename \"$m\"`" \
213          "$cache/fat_$n/`basename \"$m\"`"
214214        fi
215215    fi
216    touch "$out/names/"`basename "$m" .ppm`
216    touch "$out/names/`basename \"$m\" .ppm`"
217217    done
218218    trap 0
219219    head=$n
...... 
249249<TABLE bgcolor="$BG_COLOR" callpadding=1>
250250<TR bgcolor="$FNAME_COLOR">
251251EOF
252    for m in `ls -1 "$out/names"`; do
252    while read m; do
253253    echo "<TD><B>$m</B>"
254    done
254    done < <(ls -1 "$out/names")
255255} >"$index"
256256
257257
...... 
264264    empty=true
265265    s="<TR>"
266266    mkdir -p "$out/diff_$next" "$out/thumb_$next"
267    for m in `ls -1 "$out/names"`; do
267    while read m; do
268268    a="$cache/ppm_$n/$m.ppm"
269269    fat_a="$cache/fat_$n/$m.ppm"
270270    b="$cache/ppm_$next/$m.ppm"
...... 
298298    s=
299299    empty=false
300300    echo "<A href=\"diff_$next/$m.png\"><IMG src=\"thumb_$next/$m.png\"></A>" >>"$index"
301    done
301    done < <(ls -1 "$out/names")
302302    if ! $empty; then
303303     echo "$s<TD valign=\"middle\">" >>"$index"
304304    commit_entry "$dir" $next >>"$index"
...... 
314314    empty=true
315315    echo "<TR>" >>"$index"
316316    mkdir -p "$out/diff_$next" "$out/thumb_$next"
317    for m in `ls -1 "$out/names"`; do
317    while read m; do
318318    ppm="$cache/ppm_$next/$m.ppm"
319319    fat="$cache/fat_$next/$m.ppm"
320320    diff="$out/diff_$next/$m.png"
...... 
327327          || exit
328328    empty=false
329329    echo "<A href=\"diff_$next/$m.png\"><IMG src=\"thumb_$next/$m.png\"></A>" >>"$index"
330    done
330    done < <(ls -1 "$out/names")
331331    if ! $empty; then
332332     echo "<TD valign=\"middle\">" >>"$index"
333333    commit_entry "$dir" $next >>"$index"

Archive Download the corresponding diff file



interactive