Bug 1037809 - Use of umask should validate environment variable value is defined/valid
Summary: Use of umask should validate environment variable value is defined/valid
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Operations Network
Classification: JBoss
Component: Launch Scripts
Version: JON 3.2
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: DR02
: JON 3.2.1
Assignee: Stefan Negrea
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On:
Blocks: 1037816
TreeView+ depends on / blocked
 
Reported: 2013-12-03 20:46 UTC by Larry O'Leary
Modified: 2018-12-03 20:52 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1037816 (view as bug list)
Environment:
Last Closed: 2014-05-08 17:43:51 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 633913 0 None None None Never

Description Larry O'Leary 2013-12-03 20:46:26 UTC
Description of problem:
With the fixes to the default user file-creation mask introduced by bug 1024526, the rhq-agent.sh or rhq-agent-wrapper.sh now produce undesired and possibly confusing output in the event that RHQ_AGENT_UMASK is not set/defined.

Version-Release number of selected component (if applicable):
3.2.0

How reproducible:
Always

Steps to Reproduce:
1. Install JBoss ON system
2. Update rhq-agent-env.sh to remove RHQ_AGENT_UMASK
   Alternatively, it can be changed from:
       RHQ_AGENT_UMASK=007
   To:
       RHQ_AGENT_UMASK=
3. Start agent.

Actual results:
        0002
        Starting RHQ Agent...

Expected results:
        Starting RHQ Agent...

Additional info:
This is because the command `umask` without parameters prints the current effective user file-creation mask.

As with any user definable value, basic data validation should be performed to ensure that this value can be used. A more suitable change may be something like:

# set a default if not already set
[ -z "${RHQ_AGENT_UMASK}" ] && RHQ_AGENT_UMASK=007

# when we actually go to use it, make sure it is actually set
[ ! -z "${RHQ_AGENT_UMASK}" ] && umask ${RHQ_AGENT_UMASK}

An even better option would be something like:

# set a default if not already set
[ -z "${RHQ_AGENT_UMASK}" ] && RHQ_AGENT_UMASK=007
umask ${RHQ_AGENT_UMASK} >/dev/null || {
    echo >&2 "RHQ_AGENT_UMASK contains an invalid umask value of [${RHQ_AGENT_UMASK}]"
}

Comment 1 Libor Zoubek 2014-02-18 12:30:00 UTC
commit 5a2ef6a47b7e7d51236637f18f8f77ec02ebe20f
Author: Stefan Negrea <snegrea>
Date:   Mon Feb 10 14:09:49 2014 -0600

    [BZ 1037809] Add code set the default umask if the user makes a mistakes and removes the definition from the env sc

    Signed-off-by: Libor Zoubek <lzoubek>

commit 1d19b218993ef276908cdaed8ad1f1ce1aeed549
Author: Stefan Negrea <snegrea>
Date:   Mon Feb 10 13:52:52 2014 -0600

    [BZ 1037809, 1024526] Fix for agent file permissions and related umask settings.

    Signed-off-by: Libor Zoubek <lzoubek>

Comment 2 Libor Zoubek 2014-02-19 09:47:52 UTC
commit 1b59b9260557ac527c53e320fea56c4e2110b4c0
Author: Stefan Negrea <snegrea>
Date:   Tue Feb 18 09:00:46 2014 -0600

    [BZ 1037809] Rewrite default umask code to a more traditional shell script syntax to avoid incompatibilities with o

    (cherry picked from commit a18b558af3479687d89392bdb7bc99bac4d00f8b)
    Signed-off-by: Libor Zoubek <lzoubek>

Comment 3 Simeon Pinder 2014-03-05 22:21:31 UTC
Moving to ON_QA as available for testing in the following brew build:
https://brewweb.devel.redhat.com//buildinfo?buildID=340294

Note: the installed version is still JON 3.2.0.GA by design and this represents part of the payload for JON 3.2.1 also known as cumulative patch 1 for 3.2.0.GA.  How this will be delivered to customers is still being discussed.

Comment 4 Jan Bednarik 2014-03-07 14:39:09 UTC
Moving to VERIFIED. The undesirable output of umask (with na mask specified) is not displayed anymore.

Tested on JON 3.2.1 DR02 (Build Number: d18651a:f535707), Firefox 26

Comment 5 Mike Foley 2014-05-08 17:43:51 UTC
JON 3.2.1 released week of 5/5/2014


Note You need to log in before you can comment on or make changes to this bug.