Permalink
Browse files

Disable the globerr callback.

uftrace-0.8.1/configure has an unquoted sed pattern that looks like a
glob.  It relies on the glob failing.
  • Loading branch information...
Andy Chu
Andy Chu committed Dec 2, 2017
1 parent 8402bd6 commit 62458333261e37db64df431978c974aaad345d20
Showing with 12 additions and 3 deletions.
  1. +1 −0 benchmarks/runtime.sh
  2. +11 −3 native/libc.c
View
@@ -37,6 +37,7 @@ configure-and-show-new() {
pushd $dir >/dev/null
touch __TIMESTAMP
#$OSH -x ./configure
$OSH ./configure
echo
View
@@ -55,8 +55,16 @@ func_fnmatch(PyObject *self, PyObject *args) {
}
// error callback to glob()
//
// Disabled because of spurious errors. For example, sed -i s/.*// (without
// quotes) is OK, but it would be treated as a glob, and prints an error if the
// directory 's' doesn't exist.
//
// Bash does its own globbing -- it doesn't use libc. Likewise, I think dash
// and mksh do their own globbing.
int globerr(const char *path, int eerrno) {
fprintf(stderr, "%s: %s\n", path, strerror(eerrno));
fprintf(stderr, "globerr: %s: %s\n", path, strerror(eerrno));
return 0; // let glob() keep going
}
@@ -73,7 +81,7 @@ func_glob(PyObject *self, PyObject *args) {
int flags = 0;
// int flags = GLOB_APPEND;
//flags |= GLOB_NOMAGIC;
int ret = glob(pattern, flags, globerr, &results);
int ret = glob(pattern, flags, NULL, &results);
const char *err_str = NULL;
switch (ret) {
@@ -95,7 +103,7 @@ func_glob(PyObject *self, PyObject *args) {
break;
}
if (err_str) {
fprintf(stderr, "%s: %s\n", pattern, err_str);
fprintf(stderr, "func_glob: %s: %s\n", pattern, err_str);
}
// http://stackoverflow.com/questions/3512414/does-this-pylist-appendlist-py-buildvalue-leak

0 comments on commit 6245833

Please sign in to comment.