Permalink
Browse files
Implement >|, because the configure script for yash uses it.
Search for 'noclobber' and 'set -C' in the wild corpus. It's almost
never used.
- Loading branch information...
Showing
with
36 additions
and
1 deletion.
-
+10
−0
benchmarks/runtime.sh
-
+4
−0
core/process.py
-
+22
−1
test/wild.sh
|
|
@@ -18,6 +18,7 @@ EOF |
|
|
}
|
|
|
|
|
|
readonly TAR_DIR=_tmp/benchmarks/runtime
|
|
|
readonly OSH=$PWD/bin/osh
|
|
|
|
|
|
download() {
|
|
|
files | xargs -n 1 -I {} --verbose -- \
|
|
|
@@ -31,4 +32,13 @@ extract() { |
|
|
ls -l $TAR_DIR
|
|
|
}
|
|
|
|
|
|
# TODO: Run under bash and osh. Look for all the files that changed? Using
|
|
|
# 'find'? And then diff them.
|
|
|
|
|
|
yash() {
|
|
|
pushd $TAR_DIR/yash-2.46
|
|
|
$OSH ./configure
|
|
|
popd
|
|
|
}
|
|
|
|
|
|
"$@"
|
|
|
@@ -102,6 +102,10 @@ def _ApplyRedirect(self, r, waiter): |
|
|
|
|
|
if r.tag == redirect_e.PathRedirect:
|
|
|
if r.op_id == Id.Redir_Great: # >
|
|
|
# NOTE: This is different than >| because it respects noclobber, but
|
|
|
# that option is almost never used. See test/wild.sh.
|
|
|
mode = os.O_CREAT | os.O_WRONLY | os.O_TRUNC
|
|
|
elif r.op_id == Id.Redir_Clobber: # >|
|
|
|
mode = os.O_CREAT | os.O_WRONLY | os.O_TRUNC
|
|
|
elif r.op_id == Id.Redir_DGreat: # >>
|
|
|
mode = os.O_CREAT | os.O_WRONLY | os.O_APPEND
|
|
|
|
|
|
@@ -537,7 +537,7 @@ gentoo() { |
|
|
}
|
|
|
|
|
|
#
|
|
|
# Find Biggest Shell Scripts in Aboriginal Source Tarballs
|
|
|
# ANALYSIS: Find Biggest Shell Scripts in Aboriginal Source Tarballs
|
|
|
#
|
|
|
|
|
|
readonly AB_PACKAGES=~/hg/scratch/aboriginal/aboriginal-1.2.2/packages
|
|
|
@@ -583,6 +583,27 @@ aboriginal-biggest() { |
|
|
# 33972 gcc-4.2.1/ltcf-c.sh
|
|
|
# 39048 gcc-4.2.1/ltcf-cxx.sh
|
|
|
|
|
|
#
|
|
|
# ANALYSIS: Number of comment lines
|
|
|
#
|
|
|
# TODO: Determine if we should try to save comment lines? I think we should
|
|
|
# save more than that.
|
|
|
|
|
|
|
|
|
#
|
|
|
# ANALYSIS: Which scripts use set -C / set -o noclobber?
|
|
|
#
|
|
|
|
|
|
# VERY rare, only 13 instances, in ast, freebsd, and illumos-gate.
|
|
|
analyze-noclobber() {
|
|
|
local out=_tmp/noclobber.txt
|
|
|
# Ignore this script
|
|
|
time abspaths | grep -v 'test/wild.sh' |
|
|
|
xargs grep -E 'noclobber|^set -C|^set +C' > $out || true
|
|
|
wc -l $out
|
|
|
}
|
|
|
|
|
|
|
|
|
if test "$(basename $0)" = 'wild.sh'; then
|
|
|
"$@"
|
|
|
fi
|
|
|
|
0 comments on commit
1ea42c1