Bug 998905

Summary: [origin_broker_86] User env variable is actually not created even if it returns created message from RESTAPI if the variable length >256
Product: OpenShift Online Reporter: weiwei jiang <wjiang>
Component: MasterAssignee: Ravi Sankar <rpenta>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.xCC: ffranz, wsun, xtian, zzhao
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-08-29 12:53:41 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description weiwei jiang 2013-08-20 10:28:59 UTC
Description of problem:
when add a variable with variable name have more than 256 chars, it will pass, and no warning message output

Version-Release number of selected component (if applicable):
devenv_3678
rhc_build from devenv_3677

How reproducible:
always

Steps to Reproduce:
1. Create a app
2. Set a variable with its name have more than 255 chars
3. check the variable if it is added

Actual results:
Setting environment variable(s) ... done
rhc env list not contain the variable

Expected results:
It should FAIL  and output messages to tell user variable name is out of limit

Additional info:

Comment 1 Fabiano Franz 2013-08-20 16:05:41 UTC
Checked this with curl, no error is being returned:

curl -k --user user:pass https://host/broker/rest/applications/<id>/environment-variables -X POST -d environment_variables[][name]='1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' -d environment_variables[][value]='BAR'

Comment 2 Ravi Sankar 2013-08-20 18:02:07 UTC
Invalid testcase. Environment var limit is 512 bytes and not 256 bytes.

Comment 3 zhaozhanqi 2013-08-21 02:14:05 UTC
(In reply to Fabiano Franz from comment #1)
> Checked this with curl, no error is being returned:
> 
> curl -k --user user:pass
> https://host/broker/rest/applications/<id>/environment-variables -X POST -d
> environment_variables[][name]='1111111111111111111111111111111111111111111111
> 11111111111111111111111111111111111111111111111111111111111111111111111111111
> 11111111111111111111111111111111111111111111111111111111111111111111111111111
> 11111111111111111111111111111111111111111111111111111111111' -d
> environment_variables[][value]='BAR'

Tested this issue again, if the env variable name >256 chars, the result returned from restapi will be created.But cannot find in env list.

Comment 4 Ravi Sankar 2013-08-21 17:57:20 UTC
Fixed in https://github.com/openshift/origin-server/pull/3452

Comment 5 Ravi Sankar 2013-08-21 21:12:21 UTC
I misunderstood the issue before. Environment variable value limit is 512 bytes.
Summary of the new changes:
Added environment variable name limitations:
 - Limit length to 128 bytes.
 - Allow letters, digits and underscore but can't begin with digit
Allow '=' or ' ' in the environment variable value.

Comment 6 openshift-github-bot 2013-08-22 00:22:13 UTC
Commit pushed to master at https://github.com/openshift/li

https://github.com/openshift/li/commit/fb602f72e86d6926f92b9d6ec8509affda4f648a
Merge pull request #1845 from pravisankar/dev/ravi/bug998905

Merged by openshift-bot

Comment 7 openshift-github-bot 2013-08-22 00:22:16 UTC
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/f271a2628b8e31fe523d94de8c4b4d98d5352245
Merge pull request #3452 from pravisankar/dev/ravi/bug998905

Merged by openshift-bot

Comment 8 weiwei jiang 2013-08-22 03:03:53 UTC
Test on devenv_3683 and as follow:
1.for i in `seq 64`; do echo -n "asdf" >> file; done
2. rhc env set `cat file`=asdf -a php
   Setting environment variable(s) ... done
3. rhc env list -a php
    no output 
And then I found that variable name contains <=255 chars, it will be added 

And if variable name contains >255 chars, It will pass but will be not added (env list)

Comment 9 Ravi Sankar 2013-08-22 03:28:03 UTC
Need to test the fix on devenv_3684

Comment 11 weiwei jiang 2013-08-22 06:27:07 UTC
Test on devenv_3684 and result is :
1.for i in `seq 64`; do echo -n "asdf" >> file; done
2. rhc env set `cat file`=asdf -a php
   Setting environment variable(s) ... done
3. rhc env list -a php
    no output 
When variable name contains <=255 chars, it will be added 

And if variable name contains >255 chars, It will pass but will be not added (env list)

Comment 12 weiwei jiang 2013-08-22 07:30:49 UTC
Test on devenv_3685 and result is:

Setting environment variable(s) ... 
name
'eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'
exceeds maximum size of 128b

so verified this, thx