Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 169925
Alias:
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: Java team <java@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: Karl Schulz <g59y7jb02@sneakemail.com>
Add CC:
CC:
Remove selected CCs
URL:
Summary:
Status Whiteboard:
Keywords:

Filename Description Type Creator Created Size Actions
java-config-2.sh.diff POSIX compliance for /etc/profile.d/java-config-2.sh patch Karl Schulz 2007-03-13 10:32 0000 719 bytes Details | Diff
java-config-2.posix Use id -u if UID is unset patch Petteri Räty 2007-03-16 10:45 0000 1.02 KB Details | Diff
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 169925 depends on: Show dependency tree
Bug 169925 blocks:
Votes: 0    Show votes for this bug    Vote for this bug

Additional Comments: (this is where you put emerge --info)


Not eligible to see or edit group visibility for this bug.






View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2007-03-08 12:03 0000
With ash as login shell one get:
--
/etc/profile.d/java-config-2.sh: 14: [[: not found
--

Reproducible: Always

------- Comment #1 From Vlastimil Babka (Caster) 2007-03-13 01:48:35 0000 -------
Is changing [[ ]] to [ ] enough to make it compliant?

------- Comment #2 From Karl Schulz 2007-03-13 09:15:07 0000 -------
> Is changing [[ ]] to [ ] enough to make it compliant?

I don't think so. That leads to problems in case $UID is empty. Should be sth.
like:

--
if [ "${UID}" != 0 -a -L "${gentoo_user_vm}" ]; then
        export JAVA_HOME=${gentoo_user_vm}
# Otherwise set to the current system vm
elif [ -L /etc/java-config-2/current-system-vm ]; then
        export JAVA_HOME=${gentoo_system_vm}
fi
--

------- Comment #3 From Petteri Räty 2007-03-13 09:29:08 0000 -------
(In reply to comment #2)
> > Is changing [[ ]] to [ ] enough to make it compliant?
> 
> I don't think so. That leads to problems in case $UID is empty. Should be sth.
> like:
> 
> --
> if [ "${UID}" != 0 -a -L "${gentoo_user_vm}" ]; then
>         export JAVA_HOME=${gentoo_user_vm}
> # Otherwise set to the current system vm
> elif [ -L /etc/java-config-2/current-system-vm ]; then
>         export JAVA_HOME=${gentoo_system_vm}
> fi
> --
> 

The best way to get this fixed is to submit a patch.

------- Comment #4 From Karl Schulz 2007-03-13 10:32:47 0000 -------
Created an attachment (id=113153) [details]
POSIX compliance for /etc/profile.d/java-config-2.sh

------- Comment #5 From Karl Schulz 2007-03-13 10:34:45 0000 -------
> The best way to get this fixed is to submit a patch.

Ok, but I'm not a shell programmer...

------- Comment #6 From Roy Marples (RETIRED) 2007-03-16 07:28:21 0000 -------
Works For Me

BTW, $UID itself is a bashism. If $UID is blank you may wish to consider using
the id program depending on how anal you want this to be.

If it was me, I would just check the link in $HOME

------- Comment #7 From Petteri Räty 2007-03-16 10:34:31 0000 -------
(In reply to comment #6)
> Works For Me
> 
> BTW, $UID itself is a bashism. If $UID is blank you may wish to consider using
> the id program depending on how anal you want this to be.
> 
> If it was me, I would just check the link in $HOME
> 

No, because the root user always uses the system vm.

------- Comment #8 From Petteri Räty 2007-03-16 10:45:46 0000 -------
Created an attachment (id=113463) [details]
Use id -u if UID is unset

Uberlord: This patch should be fine then, but is id -u available on BSD for
example?

------- Comment #9 From Roy Marples (RETIRED) 2007-03-16 10:57:54 0000 -------
(In reply to comment #8)
> Created an attachment (id=113463) [edit] [details]
> Use id -u if UID is unset
> 
> Uberlord: This patch should be fine then, but is id -u available on BSD for
> example?

I would also check that the id binary is available, as it's in /usr which may
or may not be available. This script will be run in single use mode, hence
there will be times when it's not.

if [ -z "${UID}" ] ; then
   if type id >/dev/null 2>/dev/null ; then
      UID=$(id -u)
   else
      [ "${USER}" = "root" ] && UID=0
   fi
fi

OK, so the last test sucks, but it's the only thing I can think of.

------- Comment #10 From Petteri Räty 2007-03-16 11:12:20 0000 -------
Fixed in 2.0.31-r5. Thanks Karl, Uberlord and drizztbsd.

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug