[ 
https://issues.apache.org/jira/browse/SOLR-8946?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

David Smiley updated SOLR-8946:
-------------------------------
    Attachment: SOLR_8946.patch

Here's a patch, and I also moved the automatic {{<add/>}} params addition to 
only occur for the "args" mode.  It was being added for stdin mode too which 
was weird.

AFAICT the former /dev/stdin check worked on Mac OS X / Darwin, but failed on 
Ubuntu/Debian.  I have no idea how, say, Fedora/CentOS would fair.  I would 
appreciate it if someone give it a shot.  I did some playing around with 
bin/post and I think this works and the correct use of {{<add/>}} is an 
improvement too.  It would be nice to get this into Solr 5.5.1.

> bin/post script stdin detection is faulty
> -----------------------------------------
>
>                 Key: SOLR-8946
>                 URL: https://issues.apache.org/jira/browse/SOLR-8946
>             Project: Solr
>          Issue Type: Bug
>          Components: SimplePostTool
>    Affects Versions: 6.0
>         Environment: Ubuntu
>            Reporter: David Smiley
>         Attachments: SOLR_8946.patch
>
>
> Summary:  I think the {{post}} bash script tries to detect stdin the wrong 
> way.
> If I run "post -h" I see some examples, to include this:
> {code}
> echo '{commit: {}}' | bin/post -c my_collection -type application/json -out 
> yes -d
> {code}
> However if I try it, Solr returns this error: {{Cannot parse provided JSON: 
> JSON Parse Error: char=<,position=0 BEFORE='<' AFTER='add/>'}}
> I see that {{post}} is sending an {{<add />}} in certain cases, but it's not 
> supposed to when the mode is stdin.  Looking closer, it appears to be because 
> of this line:
> {{if [[ -s /dev/stdin ]]; then}}
> If I change it to this (which I figured out after googling around; I'm no 
> bash expert!):
> {{if [[ ! -t 0 ]]; then}}
> Apparently '0' represents stdin.  It works for me.  [~thelabdude] might you 
> take a look?  I'd be happy to add a formal patch & commit for this trivial 
> change but it really needs other eyes.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to