Bug 82652 - hpoj "obsolete configuration file format" error with UTF-8 locale
hpoj "obsolete configuration file format" error with UTF-8 locale
Status: CLOSED CURRENTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: perl (Show other bugs)
9
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Petr Rockai
David Lawrence
:
: 82799 87763 88956 (view as bug list)
Depends On:
Blocks: 88086
  Show dependency treegraph
 
Reported: 2003-01-24 09:55 EST by Brett Dufault
Modified: 2007-04-18 12:50 EDT (History)
9 users (show)

See Also:
Fixed In Version: ALL
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-11-11 20:20:51 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
hpoj config file for HP OfficeJet K80 (USB) (2.01 KB, text/plain)
2003-01-24 10:27 EST, Brett Dufault
no flags Details
Patch that works around the perl problem for real. (840 bytes, patch)
2003-02-23 17:34 EST, Alexandre Oliva
no flags Details | Diff
Patch against 0.90-14 that fixes the problem for good. (578 bytes, patch)
2003-03-18 12:00 EST, Alexandre Oliva
no flags Details | Diff
Workaround for hpoj on RH9 (299 bytes, text/plain)
2003-12-17 20:21 EST, Brett Dufault
no flags Details

  None (edit)
Description Brett Dufault 2003-01-24 09:55:13 EST
Description of problem:   
The /etc/rc.d/init.d/hpoj script doesn't parse the device configuration file   
correctly with a UTF-8 locale (en_US.UTF-8), and prints an error saying the   
device is using an "obsolete configuration file format".  If the LANG env var   
is changed to a non-UTF locale (en_US or C), hpoj is able to parse the   
configuration file and functions correctly.   
   
Version-Release number of selected component (if applicable):   
Using hpoj-0.90-10, Phoebe RH 8.0.93   
   
How reproducible:   
Every time   
   
Steps to Reproduce:   
1. Start with default en_US.UTF-8 locale in /etc/sysconfig/i18n   
2. Run "service hpoj setup" (as root, of course)   
3. Let script probe for HPOJ devices.  (In my setup, it's an HP OfficeJet K80   
printer/scanner/fax using the USB connection.)   
4. hpoj script successfully identifies the K80 and writes config file.   
5. Final step in hpoj setup is an option for selecting a default device.    
Script attempts to parse through configuration files, and prints:   
   
    Currently defined device names ([*]=default):   
        *** The following devices are using an obsolete configuration   
        *** file format.  Use "/etc/init.d/hpoj setup"   
        *** to delete and re-probe them:   
        --> "mlc:usb:OfficeJet_K80"   
   
6. Attempt to set printer as default (entering mlc:usb:OfficeJet_K80 when   
prompted) results in the error:   
   
    *** Device name "mlc:usb:OfficeJet_K80" is not defined!   
   
7. Give up and go with no default device (just hitting Enter when prompted).    
Script completes after printing:   
   
    Starting the HP OfficeJet Linux driver.   
        No hpoj devices have been configured.   
        As root, run "/etc/init.d/hpoj setup".   
   
8. Edit /etc/sysconfig/i18n and change LANG from en_US.UTF-8 to en_US 
9. Repeat steps 1 thru 4 (run hpoj setup, detect HPOJ device)   
10. In the final step for selecting a default device, the script now prints:   
   
    Currently defined device names ([*]=default):   
        "mlc:usb:OfficeJet_K80"   
            Model is "OfficeJet  K80".   
            Serial number is "MY2AED62M1OH".   
   
11. Enter "mlc:usb:OfficeJet_K80" at the default device prompt.  Device is 
accepted, and script ends after printing: 
   
    Starting the HP OfficeJet Linux driver. 
    [*] mlc:usb:OfficeJet_K80 
   
12. Printing and scanning work quite nicely afterwards. 
 
Actual results:   
With the en_US.UTF-8 locale, hpoj is unable to read in its configuration file   
and reports that devices are using an obsoletel config file format.  With a   
non-Unicode locale (en_US, C) hpoj works correctly. 
 
Expected results:   
Since Unicode locales are the default now, it'd probably be nice if hpoj   
worked with both UTF-8 and non-UTF-8 locales.   
   
Additional info:   
The problem seems to be line 233 in /etc/rc.d/init.d/hpoj: 
 
        if ($configLine=~/^\s*([^\s#+=]+)\s*(\+*)=+\s*/) { 
 
If I were a Perl/UTF-8/regexp guru, it'd probably be obvious what was going   
wrong here, but I'm just a punter in those areas.  :-)  Inserting debugging   
prints around this line shows that with en_US.UTF-8, the config file lines are   
being read in, but none are matching the regexp, so no key/value pairs are   
created.  This results in an empty cfgstrVersion, the config version check   
at line 251 fails, and the device gets blacklisted.
Comment 1 Tim Waugh 2003-01-24 10:00:06 EST
Does it help to put 'use utf8;' after 'use strict;' at the beginning of that script?
Comment 2 Brett Dufault 2003-01-24 10:08:26 EST
Still got same "obsolete conf" errors after adding 'use utf8;' after 'use 
strict;' (when using en_US.UTF-8 locale). 
 
Comment 3 Tim Waugh 2003-01-24 10:20:58 EST
Please attach the config file you have.  Thanks.
Comment 4 Brett Dufault 2003-01-24 10:27:10 EST
Created attachment 89575 [details]
hpoj config file for HP OfficeJet K80 (USB)

Original file location was /etc/ptal/mlc:usb:OfficeJet_K80
Comment 5 Tim Waugh 2003-01-24 10:57:53 EST
Smaller test case:

echo abc | perl -ne 'use locale;print if /[^\s]+/'

Actual output: (nothing)
Expected output: abc
Comment 6 Tim Waugh 2003-01-26 14:51:50 EST
*** Bug 82799 has been marked as a duplicate of this bug. ***
Comment 7 Alexandre Oliva 2003-02-23 17:34:14 EST
Created attachment 90300 [details]
Patch that works around the perl problem for real.

The path that''s in place in 0.90-12 (phoebe3) didn't quite work.  Setting this
variable after the perl script starts doesn't seem to have the intended effect.
 This ugly work around seems to do better.
Comment 8 Alexandre Oliva 2003-03-18 12:00:41 EST
Created attachment 90647 [details]
Patch against 0.90-14 that fixes the problem for good.

Except the patch that fixed it for real didn't fix it at all.  It isn't even
correct perl.  I know I tested it and it worked, but it might be that I
inadvertently had LANG=C set in the environment, because upon further attempts
to use the printer (you can tell I don't use it very often, can't you? :-) it
was broken again :-(

Anyway, this patch seems to be better perl code, and it was tested for sure
with LANG=C and LANG=en_US.UTF-8, and in both cases it did the right thing. 
Deep apologies for the wasted time.
Comment 9 Tim Waugh 2003-03-18 12:31:13 EST
Thanks, applied in hpoj-0.90-15.
Comment 10 Tim Waugh 2003-04-02 05:13:01 EST
*** Bug 87763 has been marked as a duplicate of this bug. ***
Comment 12 Mike Basinger 2003-04-02 14:31:20 EST
To get RedHat 9 to configure a HP OfficeJet K80xi via usb, I had to upgrade
redhat-config-printer and redhat-config-printer-gui to 0.6.49.
Comment 13 Tim Waugh 2003-04-02 16:43:01 EST
Completely separate issue.

This bug report is about perl's broken regular expression handling in UTF8
causing the hpoj initscript to fail.

A work-around would probably be:

export LANG=C
service hpoj restart

(on each boot)
Comment 14 Gilles Detillieux 2003-04-15 14:01:03 EDT
*** Bug 88956 has been marked as a duplicate of this bug. ***
Comment 15 Tim Waugh 2003-05-06 07:04:23 EDT
Looks like this might be fixed in perl-5.8.1-0.pre19333.1.
Comment 16 Milan Kerslager 2003-12-17 18:07:55 EST
Red Hat Enterprise Linux 3 has the problem too.
Comment 17 Brett Dufault 2003-12-17 20:21:56 EST
Created attachment 96597 [details]
Workaround for hpoj on RH9

hpoj-0.90-14 on RH9 with UTF-8 locale was still a no-go for me, generates the
same "obsolete configuration" message as previous hpoj versions.

Attached is a workaround I've been using with hpoj-0.90-14 on RH9, basically a
variation of Tim Waugh's comment #13.  Instead of having /etc/rc.d/init.d/hpoj
as a symlink to the /usr/sbin/ptal-init script, I turned it into a more
traditional init.d script that sets LANG=C and calls ptal-init.  A bit cheezy,
but it avoids having to do a manual export/restart after each boot.

I don't have RHEL 3 installed here, but looks like that's also using
hpoj-0.90-14, so might be worth trying something similar there.
Comment 18 Brett Dufault 2003-12-17 20:30:19 EST
I can confirm that hpoj is working for me using en_US.UTF-8 on Fedora Core 1 (i.e., 
with hpoj-0.90-19 and perl-5.8.1-92). 
 
Comment 19 Tim Waugh 2003-12-18 04:08:24 EST
How about the actual perl bug causing the problem, with the test case
in comment #5? (It works for me in Fedora Core 1).
Comment 20 Brett Dufault 2003-12-18 08:07:11 EST
Test case from comment #5 fails for me on RH9/perl-5.8.0-88.3.  Works for me using 
Fedora Core 1/perl-5.8.1-92.  (en_US.UTF-8 locale in each case.) 
 
Comment 21 Brett Dufault 2003-12-18 08:33:41 EST
Playing catch-up here (apologies, been on the road a lot for work).  I can confirm 
that applying Alexandre's patch from comment #8 to hpoj-0.90-14 worked for me 
with RH9.  Seems like a simpler solution than the cheezy init.d script approach I 
mentioned in comment #17. 
 
Comment 22 Milan Kerslager 2004-01-04 02:26:59 EST
Test case from comment #5 fails for me on RHEL 3 (perl-5.8.0-88.4).

This bug is real candidate for RHEL3 errata (see bug #112339).
Comment 23 Marc A. MIronescu 2004-01-05 00:52:19 EST
I had also problemms with hpoj since RHL 9 was  released. But then
hpoj-90 build 15 worked fine. RHEL 3 came out with build 14. It means
it has the same problemm! Why wasn't hpoj not upgraded to a newer
build? Heck I even recompiled hpoj from Fedora Core 1 on RHL (rebuild
the src rpm) and it works!!! Why shit a broken version when there is a
fix for it???!!!
Comment 24 Tim Waugh 2004-01-05 04:28:57 EST
It is important to remember that this is a perl bug, not a bug in hpoj.
Comment 26 Jason Vas Dias 2005-11-11 20:20:51 EST
This bug is fixed in all current Red Hat perl releases - closing out.

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