Skip to contentSkip to conversation

utilities/autodate.sh: too many \s

PATCH In review Trevor Woerner 3 participants 9 messages Jan 16, 2017 – Jan 23, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 utilities/autodate.sh: too many \s

Remove extraneous \ which causes build to fail:

	! LaTeX Error: There's no line here to end.

	See the LaTeX manual or LaTeX Companion for explanation.
	Type  H <return>  for immediate help.
	 ...

	l.2 \\n
	       ewcommand{\\commityear}{2017}
	?
	! Emergency stop.
	 ...

	l.2 \\n
	       ewcommand{\\commityear}{2017}
	Your command was ignored.
	Type  I <command> <return>  to replace it with another command,
	or  <return>  to continue without it.
---
 utilities/autodate.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
utilities/autodate.sh +1 -1
index 6df8f99..84b4ea7 100644
@@ -45,4 +45,4 @@ year=`date --date="$date_str" +%Y`
 day=`date --date="$date_str" +%e`
 
 echo "\\date{$month $day, $year$modified}"
-echo "\\\newcommand{\\\commityear}{$year}"
+echo "\\newcommand{\\commityear}{$year}"
Signature · 1 line
2.11.0.258.ge05806d
#1 lore raw
Quoted 1 line · Trevor Woerner

Remove extraneous \ which causes build to fail:

Hi Trevor,

Apologies for submitting a non portable script.
I assumed that if a script works on "dash", it should work on other sh variants. But it was a wrong assumption. I should have tested on "bash" at least.

I'm submitting a patch of the script with portability in mind. Can you try it?

Thanks, Akira

#2 lore raw

PATCH 1/1 autodate.sh: Use printf instead of echo

From bcd083c6be7cd9c69d1e05d19d732c32147bfd9a Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Tue, 17 Jan 2017 20:04:54 +0900
Subject: [PATCH] autodate.sh: Use printf instead of echo

Using "echo" command to generate output containing "\" characters caused a build error depending on the variant of "sh". For portability, we should use "printf" via "env" command.

---
 utilities/autodate.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
utilities/autodate.sh +3 -3
index 6df8f99..a56bc70 100644
@@ -35,7 +35,7 @@ else
 	gitstatus=`git status --porcelain | wc -l`
 	if [ $gitstatus != "0" ]
 	then
-		modified=" (m)"
+		modified="(m)"
 	else
 		modified=""
 	fi
@@ -44,5 +44,5 @@ month=`date --date="$date_str" +%B`
 year=`date --date="$date_str" +%Y`
 day=`date --date="$date_str" +%e`
 
-echo "\\date{$month $day, $year$modified}"
-echo "\\\newcommand{\\\commityear}{$year}"
+env printf "\\date{%s %s, %s %s}\n" $month $day $year $modified
+env printf "\\\newcommand{\\\commityear}{%s}\n" $year
Signature · 1 line
2.7.4
author Tested-by on v1 1/1
#3 lore raw

Re: [PATCH] autodate.sh: Use printf instead of echo

Quoted 11 lines · Akira Yokosawa

From bcd083c6be7cd9c69d1e05d19d732c32147bfd9a Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Tue, 17 Jan 2017 20:04:54 +0900
Subject: [PATCH] autodate.sh: Use printf instead of echo

Using "echo" command to generate output containing "\" characters caused a build error depending on the variant of "sh". For portability, we should use "printf" via "env" command.

Fixes 878bf8160a5c
Quoted 30 lines
---
 utilities/autodate.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
utilities/autodate.sh +3 -3
index 6df8f99..a56bc70 100644
@@ -35,7 +35,7 @@ else
 	gitstatus=`git status --porcelain | wc -l`
 	if [ $gitstatus != "0" ]
 	then
-		modified=" (m)"
+		modified="(m)"
 	else
 		modified=""
 	fi
@@ -44,5 +44,5 @@ month=`date --date="$date_str" +%B`
 year=`date --date="$date_str" +%Y`
 day=`date --date="$date_str" +%e`
 
-echo "\\date{$month $day, $year$modified}"
-echo "\\\newcommand{\\\commityear}{$year}"
+env printf "\\date{%s %s, %s %s}\n" $month $day $year $modified
+env printf "\\\newcommand{\\\commityear}{%s}\n" $year
Signature · 1 line
2.7.4
#4 lore raw

PATCH v2 1/1 autodate.sh: Use printf command instead of echo

From b981648ff25387ecea68b55350671c55ad894884 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Tue, 17 Jan 2017 20:04:54 +0900
Subject: [PATCH v2] autodate.sh: Use printf command instead of echo

Using "echo" command to generate output containing "\" characters caused a build error depending on the variant of "sh". For portability, we should use "printf" via "env" command.

Fixes 878bf8160a5c ("Make date of git commit be reflected automatically")

---
v2: Changes in commit log
o Tested-by from Trevor
o Title of fixed commit

 utilities/autodate.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
utilities/autodate.sh +3 -3
index 6df8f99..a56bc70 100644
@@ -35,7 +35,7 @@ else
 	gitstatus=`git status --porcelain | wc -l`
 	if [ $gitstatus != "0" ]
 	then
-		modified=" (m)"
+		modified="(m)"
 	else
 		modified=""
 	fi
@@ -44,5 +44,5 @@ month=`date --date="$date_str" +%B`
 year=`date --date="$date_str" +%Y`
 day=`date --date="$date_str" +%e`
 
-echo "\\date{$month $day, $year$modified}"
-echo "\\\newcommand{\\\commityear}{$year}"
+env printf "\\date{%s %s, %s %s}\n" $month $day $year $modified
+env printf "\\\newcommand{\\\commityear}{%s}\n" $year
Signature · 1 line
2.7.4
#5 lore raw

Re: [PATCH v2] autodate.sh: Use printf command instead of echo

Quoted 9 lines · Akira Yokosawa
Quoted 1 line

From b981648ff25387ecea68b55350671c55ad894884 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Tue, 17 Jan 2017 20:04:54 +0900
Subject: [PATCH v2] autodate.sh: Use printf command instead of echo

Using "echo" command to generate output containing "\" characters caused a build error depending on the variant of "sh". For portability, we should use "printf" via "env" command.

Quoted 8 lines
Fixes 878bf8160a5c ("Make date of git commit be reflected automatically")

---
v2: Changes in commit log
o Tested-by from Trevor
o Title of fixed commit

Well, seems like I should have put the "Tested-by:" from Trevor below my "Signed-off-by:" to respect the chain of event. If it is not too late, can you reorder them for me?

Thanks, Akira

Quoted 26 lines
 utilities/autodate.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
utilities/autodate.sh +3 -3
index 6df8f99..a56bc70 100644
@@ -35,7 +35,7 @@ else
 	gitstatus=`git status --porcelain | wc -l`
 	if [ $gitstatus != "0" ]
 	then
-		modified=" (m)"
+		modified="(m)"
 	else
 		modified=""
 	fi
@@ -44,5 +44,5 @@ month=`date --date="$date_str" +%B`
 year=`date --date="$date_str" +%Y`
 day=`date --date="$date_str" +%e`
 
-echo "\\date{$month $day, $year$modified}"
-echo "\\\newcommand{\\\commityear}{$year}"
+env printf "\\date{%s %s, %s %s}\n" $month $day $year $modified
+env printf "\\\newcommand{\\\commityear}{%s}\n" $year
#6 lore raw

Re: [PATCH v2] autodate.sh: Use printf command instead of echo

Quoted 19 lines · Akira Yokosawa
Quoted 9 lines · Akira Yokosawa
Quoted 1 line

From b981648ff25387ecea68b55350671c55ad894884 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Tue, 17 Jan 2017 20:04:54 +0900
Subject: [PATCH v2] autodate.sh: Use printf command instead of echo

Using "echo" command to generate output containing "\" characters caused a build error depending on the variant of "sh". For portability, we should use "printf" via "env" command.

Quoted 8 lines
Fixes 878bf8160a5c ("Make date of git commit be reflected automatically")

---
v2: Changes in commit log
o Tested-by from Trevor
o Title of fixed commit

Quoted 3 lines

Well, seems like I should have put the "Tested-by:" from Trevor below my "Signed-off-by:" to respect the chain of event. If it is not too late, can you reorder them for me?

You got lucky, internet-access troubles. ;-)

Queued and pushed with the Tested-by and Signed-off-by reversed.

Thanx, Paul

Quoted 29 lines

Thanks, Akira

Quoted 26 lines
 utilities/autodate.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
utilities/autodate.sh +3 -3
index 6df8f99..a56bc70 100644
@@ -35,7 +35,7 @@ else
 	gitstatus=`git status --porcelain | wc -l`
 	if [ $gitstatus != "0" ]
 	then
-		modified=" (m)"
+		modified="(m)"
 	else
 		modified=""
 	fi
@@ -44,5 +44,5 @@ month=`date --date="$date_str" +%B`
 year=`date --date="$date_str" +%Y`
 day=`date --date="$date_str" +%e`
 
-echo "\\date{$month $day, $year$modified}"
-echo "\\\newcommand{\\\commityear}{$year}"
+env printf "\\date{%s %s, %s %s}\n" $month $day $year $modified
+env printf "\\\newcommand{\\\commityear}{%s}\n" $year
#7 lore raw
In reply to Akira Yokosawa

Hi Akira,

Quoted 4 lines · Akira Yokosawa
Quoted 1 line · Trevor Woerner

Remove extraneous \ which causes build to fail:

I'm submitting a patch of the script with portability in mind. Can you try it?

Yes, this patch works for me. Thanks for the update, sorry for the delay.

#8 lore raw
Quoted 9 lines · Trevor Woerner

Hi Akira,

Quoted 4 lines · Akira Yokosawa
Quoted 1 line · Trevor Woerner

Remove extraneous \ which causes build to fail:

I'm submitting a patch of the script with portability in mind. Can you try it?

Yes, this patch works for me. Thanks for the update, sorry for the delay.

Thanks for testing!
Can I get your Tested-by:?

Thanks, Akira