mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-03-19 17:30:27 +08:00
Mitigate extreme slowdown on systems without xattr.h or getfattr. Standard output was being spammed, resulting in a test that currently runs in around a minute to balloon out to almost 20.
This commit is contained in:
parent
5f89cd0c10
commit
848e85171a
@ -87,6 +87,11 @@ if(UNAME)
|
||||
set(TMP_BUILDNAME "${osname}-${osrel}-${cpu}")
|
||||
endif()
|
||||
|
||||
find_program(GETFATTR NAMES getfattr)
|
||||
if(GETFATTR)
|
||||
set(HAVE_GETFATTR TRUE)
|
||||
endif()
|
||||
|
||||
# Define some Platforms
|
||||
if(osname MATCHES "CYGWIN.*")
|
||||
set(ISCYGWIN yes)
|
||||
|
@ -373,6 +373,9 @@ are set when opening a binary file on Windows. */
|
||||
/* Define to 1 if you have the <ctype.h> header file. */
|
||||
#cmakedefine HAVE_CTYPE_H 1
|
||||
|
||||
/* Define to 1 if you have the getfattr command line utility. */
|
||||
#cmakedefine HAVE_GETFATTR 1
|
||||
|
||||
/* Define to 1 if you have the <sys/xattr.h> header file. */
|
||||
#cmakedefine HAVE_SYS_XATTR_H
|
||||
|
||||
|
@ -82,6 +82,12 @@ AC_LANG_POP([C])
|
||||
if test $have_no_strict_aliasing = no; then
|
||||
CFLAGS=$SAVE_CFLAGS
|
||||
fi
|
||||
|
||||
##
|
||||
# Check to see if we have getfattr
|
||||
##
|
||||
AC_CHECK_PROGS([HAVE_GETFATTR], [getfattr])
|
||||
|
||||
##
|
||||
# Some files need to exist in build directories
|
||||
# that do not correspond to their source directory, or
|
||||
|
@ -1648,16 +1648,22 @@ fprintf(stderr,"@@@ %s=|%s|\n",p,xvalue);
|
||||
}
|
||||
}
|
||||
#else /*!HAVE_SYS_XATTR_H*/
|
||||
|
||||
#ifdef HAVE_GETFATTR
|
||||
{
|
||||
FILE *fp;
|
||||
char cmd[4096];
|
||||
memset(cmd,0,sizeof(cmd));
|
||||
snprintf(cmd,sizeof(cmd),"getfattr %s | grep -c '.daos'",path);
|
||||
if((fp = popen(cmd, "r")) != NULL) {
|
||||
fscanf(fp, "%d", &rc);
|
||||
pclose(fp);
|
||||
snprintf(cmd,sizeof(cmd),"getfattr %s | grep -c '.daos'",path);
|
||||
if((fp = popen(cmd, "r")) != NULL) {
|
||||
fscanf(fp, "%d", &rc);
|
||||
pclose(fp);
|
||||
}
|
||||
}
|
||||
}
|
||||
#else /*!HAVE_GETFATTR*/
|
||||
/* We just can't test for DAOS container.*/
|
||||
stat = 0;
|
||||
#endif /*HAVE_GETFATTR*/
|
||||
#endif /*HAVE_SYS_XATTR_H*/
|
||||
}
|
||||
/* Test for DAOS container */
|
||||
|
Loading…
x
Reference in New Issue
Block a user