lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi] Mustn't expansions precede redirections?


From: Greg Chicares
Subject: [lmi] Mustn't expansions precede redirections?
Date: Mon, 18 May 2020 22:41:49 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0

TL;DR: in this invocation...

  rm --force eraseme*
  touch eraseme.x eraseme.y
  2>&1 foo eraseme* | bar > eraseme_out
           ^^^^^^^^

...can the highlighted expansion of 'eraseme*' on the last line
include 'eraseme_out'?

I thought the order was
  perform shell expansions, then
  set up redirections, then
  exec the command
but the evidence below says I'm wrong, so...how can the snippet above
be rewritten so that the expansion is performed before the output file
is created? I hesitate to insert a call to 'sponge' or to add braces
or parentheses without understanding where I'm mistaken.

I don't know how to reproduce this problem, but one of my logs says:

PERFORM=wine /opt/lmi/src/lmi/test_coding_rules_test.sh
Testing 'test_coding_rules'.
--- eraseme_expected    2020-05-18 14:14:57.934961183 +0000
+++ eraseme_observed    2020-05-18 14:14:57.932961172 +0000
@@ -48,0 +49,2 @@
+File 'eraseme_observed' lacks current copyright.
+File 'eraseme_observed' lacks lmi URL.
make[1]: *** [/opt/lmi/src/lmi/workhorse.make:968: test_coding_rules.exe] Error 
1

To build that target, 'objects.make' says:

test_coding_rules_test := PERFORM=$(PERFORM) $(srcdir)/test_coding_rules_test.sh
test_coding_rules$(EXEEXT): POST_LINK_COMMAND = $(test_coding_rules_test)

where "POST_LINK_COMMAND" DWISOTT. Now, 'test_coding_rules_test.sh'
says, in relevant part:

#!/bin/sh
echo "Testing 'test_coding_rules'."
rm --force eraseme*
2>&1 $PERFORM ./test_coding_rules \
  . \
  eraseme* \
  | sed -e '/^[ 0-9]\{9\} \(source files\|source lines\|marked defects\)/d' \
  >eraseme_observed

where "$PERFORM" is "wine". This seems to demonstrate that the
answer to the TL;DR question is at least "possibly".


reply via email to

[Prev in Thread] Current Thread [Next in Thread]