Operating System - HP-UX
1833311 Members
2928 Online
110051 Solutions
New Discussion

Re: set_parms date_time error

 
Nivesh Patnaik
Frequent Advisor

set_parms date_time error

I get this error on an 11.00 system when
using set_parms date_time to set the date of the month to either 8 or 9. All other days
of the month work and I get the prompt to
enter the hour of the day.
Thanks,
-Nivesh

_______________________________________________________________________________

You will be prompted for the date and time. Please enter all values
numerically, for example January is 1. The values in the parentheses
give the acceptable range of responses.
_______________________________________________________________________________


Please enter the last two digits of the year (00-99), then press [Return] 03

Please enter the month (1-12), then press [Return] 10

Please enter the date of the month (1-31), then press [Return] 8
/sbin/set_parms.d/12_date_time[55]: 08: The specified number is not valid for th
is command.
#
I gave him his drink as usual. Some men can't hold their arsenic.
6 REPLIES 6
Mark Grant
Honored Contributor

Re: set_parms date_time error

Well the odd thing about this is that that error message isn't in the script at all. It looks like that 08 is being used where it shouldn't be. Is there any possibility at all that your keyboard has some funny mapping for those two numbers because I can't see where that extra zero comes in.
Never preceed any demonstration with anything more predictive than "watch this"
Nivesh Patnaik
Frequent Advisor

Re: set_parms date_time error

/sbin/set_parms.d/12_date_time gets executed.
I checked the function that gets called when
running set_parms from a CUI session.

Here is the excerpt:

########################################################
#
# This function actually prompts the user for the time/date info.
#
time_set()
{

# Define date/time variables as 2 digits, right justified, leading zero filled.
typeset -Z2 century year month day hour minute



This is why, when the variable day gets read,
it left pads the 8 with a zero.

The error occurs when the following piece of
code executes:

# Read the day
while :
do
echo "\nPlease enter the date of the month (1-31), then press [Return] \c
"
read day
if (( day > 0 )) && check_day
then
break
else
Retry "Day number out of range for the month.\n"
fi
done

Right where it does "if (( day > 0 )) && check_day" is when the error occurs. I even tried one condition at a time, and both the
conditions generated the error.

Strange, the error happens for only the number 8 and 9 as the date of the month.
I gave him his drink as usual. Some men can't hold their arsenic.
A. Clay Stephenson
Acclaimed Contributor

Re: set_parms date_time error

It looks as though there is a bug in the shell that is treating typeset -Z2 variables
with single leading zeroes as octal and that is why 08 and 09 are failing. They are invalid octal values. I've seen this sort of problem before. Look for cumulative shell patches.
If it ain't broke, I can fix that.
T G Manikandan
Honored Contributor

Re: set_parms date_time error

john korterman
Honored Contributor

Re: set_parms date_time error

Hi Nivesh,
your system has apparently installed patch PHCO_26789.
The description for this patch says, among other things:

"...This patch also fixes the POSIX shell to adhere to ISOC standards by recognizing octal and hexa decimal notations ."

which means that a number starting with zero will be recognized as an octal number; hence the problem with illegal octal numbers as 8 and 9. It suggests a workaround but only for one particular script.
I have tried to search for an anti-PHCO_26789 patch, but without luck; perhaps other people have more success.
If the alternatives are to either uninstall the patch or use a non-posix shell, I think it would be a good idea to ask HP directly.
If you do that, please tell us about the result.

regards,
John K.
it would be nice if you always got a second chance
Nivesh Patnaik
Frequent Advisor

Re: set_parms date_time error

Just for proof of concept I modified the
code for set_parms and /sbin/set_parms.d/12_date_time so that the single
digit date would be read as input, and
the left padding of zero would be performed
after the date checked out okay. This fix had to be done in two places, for the Xserver related functions and the straight terminal functions. That worked! Dates of 8 and 9 were accepted without any errors.

Then I reverted to the original HP versions
of set_parms and dependent scripts, and then uninstalled PHCO_23744 which had come off
the Quality Pack bundle for 11.00, March 2003.

That still left me with /sbin/sh from PHCO_23744 instead of the one from PHCO_18447
which it should have reverted to. Cannot
simply clobber /sbin/sh ofcourse!

So I installed PHCO_20816 because I didn't
want to encounter the eval aborts with syntax
errors introduced in PHCO_22537 and PHCO_23873.

set_parms date_time now works fabulously with
the POSIX shell that came off PHCO_20816.

Problem fixed. Thank you all for your input.

-Nivesh
I gave him his drink as usual. Some men can't hold their arsenic.