Project

General

Profile

Bug #7710

degradation after 7512 with GNU find and GNU echo

Added by Igor Kozhukhov over 2 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Start date:
2016-12-30
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage

Description

/myshare/ssd02/builds/dilos-illumos.lx/usr/src/test/zfs-tests
find: warning: you have specified the -maxdepth option after a non-option argument -type, but options are not positional (-maxdepth affects tests specified before it as well as those specified after it).  Please specify options before other arguments.

/myshare/ssd02/builds/dilos-illumos.lx/usr/src/test/zfs-tests/callbacks
sh: 1: Syntax error: "(" unexpected
mksh: Fatal error: The command `echo ~(N)*(*.sh|*.ksh)' returned status `2'
Current working directory: /myshare/ssd02/builds/dilos-illumos.lx/usr/src/test/zfs-tests/callbacks
*** Error code 1
The following command caused the error:
cd callbacks; pwd; dmake install
dmake: Fatal error: Command failed for target `callbacks'
Current working directory /myshare/ssd02/builds/dilos-illumos.lx/usr/src/test/zfs-tests

History

#1

Updated by Igor Kozhukhov over 2 years ago

  • Subject changed from degradation after 7512 with GNU find and GNU ego to degradation after 7512 with GNU find and GNU echo
#2

Updated by Igor Kozhukhov over 2 years ago

i'd like propose update:

igor@infra-99-018:/myshare/ssd02/builds/dilos-illumos.lx/usr/src/test/zfs-tests$ g diff .
diff --git a/usr/src/test/zfs-tests/Makefile b/usr/src/test/zfs-tests/Makefile
index 0c7218867a..87453af7b4 100644
--- a/usr/src/test/zfs-tests/Makefile
+++ b/usr/src/test/zfs-tests/Makefile
@@ -15,6 +15,6 @@

 .PARALLEL: $(SUBDIRS)

-SUBDIRS:sh = find ./* -type d -maxdepth 0
+SUBDIRS:sh = find ./* -maxdepth 0 -type d

 include $(SRC)/test/Makefile.com
diff --git a/usr/src/test/zfs-tests/Makefile.com b/usr/src/test/zfs-tests/Makefile.com
index b05381cbf7..f78f993440 100644
--- a/usr/src/test/zfs-tests/Makefile.com
+++ b/usr/src/test/zfs-tests/Makefile.com
@@ -16,9 +16,10 @@
 # The following file name generation rules allow the addition of tests,
 # libraries and other miscellaneous files without having to specify them
 # all individually in lower level Makefiles.
-PROGS:sh = echo ~(N)*(*.sh|*.ksh)
-FILES:sh = echo ~(N)*(*.cfg|*shlib|*.run|*.bz2|*.d|*.fio)
-FILES:sh += echo ~(N)*(*.Z|*.txt|*.out|*.err|*.zcp)
+PROGS:sh = find . -maxdepth 1 -type f \( -name "*.sh" -o -name "*.ksh" \)
+FILES:sh = find . -maxdepth 1 -type f \( -name "*.cfg" -o -name "*shlib" \
+-o -name "*.run" -o -name "*.bz2" -o -name "*.d" -o -name "*.fio" \
+-o -name "*.Z" -o -name "*.txt" -o -name "*.out" -o -name "*.err" -o -name "*.zcp" \)

 CMDS = $(PROGS:%.sh=$(TARGETDIR)/%)
 CMDS += $(PROGS:%.ksh=$(TARGETDIR)/%)

it will be more universal

#3

Updated by Gary Mills over 2 years ago

What happens if you replace the `echo' with `print'? `echo' should never be used in portable scripts. Only `print' is standardized.

#4

Updated by Igor Kozhukhov over 2 years ago

Gary Mills wrote:

What happens if you replace the `echo' with `print'? `echo' should never be used in portable scripts. Only `print' is standardized.

it is not issue with 'echo' or 'print'
it is issue with KSH - because it use internal functions instead of external tools and you are failed if you have another primary SHELL, i have DASH as example with issue.

#5

Updated by Matthew Ahrens over 2 years ago

The fix uses "find", which avoids the portability problems of echo/print/ksh.

#6

Updated by Electric Monk over 2 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

git commit 1a12e87ed13adc3a42202206a3fdaf4437556511

commit  1a12e87ed13adc3a42202206a3fdaf4437556511
Author: John Wren Kennedy <john.kennedy@delphix.com>
Date:   2017-01-18T22:59:02.000Z

    7710 degradation after 7512 with GNU find and GNU echo
    Reviewed by: Matthew Ahrens <mahrens@delphix.com>
    Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
    Reviewed by: Paul Dagnelie <pcd@delphix.com>
    Approved by: Dan McDonald <danmcd@omniti.com>

Also available in: Atom PDF