Issue 1174: Pachtset-created hook submit not correct arguments
Status:  New
Owner: ----
Reported by altm...@gmail.com, Nov 9, 2011
Affected Version: 2.2.1-3-ge771d97

When you using the patchset-created cmd arguments the username will parsed differently (patchste-created and comment-added) when using the same script for parsing. 

What steps will reproduce the problem?
1. Active patchset-created Hook
2. Parse arguments in python
3. Get the arguments with $@

What is the expected output?

  print  sys.argv[1:]
    ### PRINT OF sys.argv[1:] ###
    
    ['--action', 'new',
    '--change','I87f7802d438d5640779daa9ac8196aeb3eec8c2a',
    '--change-url',
    'http://<hostname>:8080/308'
    '--project', 'private/bar',
    '--branch', 'master',

    '--uploader', 'xxxxxxx-xxxxx xxxxxxx (xxxxxxxxxxxxx.xxxxxxx@xxx-xxxx.xx)',

    '--commit', '49aae9befaf27a5fede51b498f0660199f47b899',
    '--patchset', '1']

   ### PRINT OF sys.argv[1:] ###



 What do you see instead?

    print  sys.argv[1:]
    ### PRINT OF sys.argv[1:] ###
    
    ['--action', 'new',
    '--change','I87f7802d438d5640779daa9ac8196aeb3eec8c2a',
    '--change-url',
    'http://<hostname>:8080/308'
    '--project', 'private/bar',
    '--branch', 'master',
    '--uploader', 'xxxxxxx-xxxxx', 'xxxxxxx', '(xxxxxxxxxxxxx.xxxxxxx@xxx-xxxx.xx)', <<<< Here is the problem >>>>
    '--commit', '49aae9befaf27a5fede51b498f0660199f47b899',
    '--patchset', '1']

	 ### PRINT OF sys.argv[1:] ###


Please provide any additional information below.

See in the attachment for the parsing script. 

gerrit_parsing_arguments.txt
3.2 KB   View   Download
Jan 6, 2014
#1 anjan.tu...@gmail.com
Hi All,

I am trying to setup gerrit 2.8 in my organization as code review tool.

I am new to setting up gerrit. With the help of your comments, i am able to understand and write the hooks, but i was struck at certain point

./comment-added --change Ie663469f9c9e69c68213b7955855cbbff055cce9 --is-draft false --change-url http://<hostname>:8080/6 --project test --branch master --author xxxxxxx-xxxxx xxxxxxx (xxxxxxxxxxxxx.xxxxxxx@xxx-xxxx.xx) --commit e2600c7224953085479263a79177910442a92c2f --comment Patch Set 3: (1 comment)

bash: syntax error near unexpected token `('

Bash is not accepting '(' from command-line. Your comments are forward to this context. Can anyone of you please help me in crossing this point. How you make hack here to recognize '(' in command line arguments.

With this issue, i even not entering into script while running. If i enter, then i can write logic to take arguments and quote the space separated values to make them as single value (ex. xxxxxxx-xxxxx xxxxxxx (xxxxxxxxxxxxx.xxxxxxx@xxx-xxxx.xx) to 'xxxxxxx-xxxxx xxxxxxx (xxxxxxxxxxxxx.xxxxxxx@xxx-xxxx.xx)').

Or else please tell me the origin point in gerrit form where hook is getting called, so that i can place quotes around values in the origin point itself..

Can you please consider it as urgent and reply me ASAP..?

Thanks & Regards
Anjan