Apache Solr open-source search software
SOLR-8946: fix bin/post stdin detection. faulty on Ubuntu; maybe others
David Smiley7833f7f69af4
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex b594afbfe38..2b6c868bb5c 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -118,6 +118,8 @@ Bug Fixes* SOLR-7729: ConcurrentUpdateSolrClient ignores the collection parameter in some methods.(Nicolas Gavalda, Jorge Luis Betancourt Gonzalez via Mark Miller)++* SOLR-8946: bin/post failed to detect stdin usage on Ubuntu; maybe other unixes. (David Smiley)Optimizations----------------------diff --git a/solr/bin/post b/solr/bin/postindex 92172ab2429..73e59ed4c41 100755--- a/solr/bin/post+++ b/solr/bin/post@@ -140,7 +140,7 @@ while [ $# -gt 0 ]; doshiftPROPS+=("-Dport=$1")elif [[ ("$1" == "-d" || "$1" == "--data" || "$1" == "-") ]]; then- if [[ -s /dev/stdin ]]; then+ if [[ ! -t 0 ]]; thenMODE="stdin"else# when no stdin exists and -d specified, the rest of the arguments@@ -150,6 +150,9 @@ while [ $# -gt 0 ]; doif [[ $# -gt 0 ]]; thenARGS=("$@")shift $#+ else+ # SPT needs a valid args string, useful for 'bin/post -c foo -d' to force a commit+ ARGS+=("<add/>")fifielse@@ -209,10 +212,6 @@ if [[ $MODE != "stdin" && $MODE != "args" ]]; thenPARAMS=("${URLS[@]}")fielse- if [[ ${#ARGS[@]} == 0 ]]; then- # SPT needs a valid (to post to Solr) args string, useful for 'bin/post -c foo -d' to force a commit- ARGS+=("<add/>")- fiPARAMS=("${ARGS[@]}")fi