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.
Does it help to put 'use utf8;' after 'use strict;' at the beginning of that script?
Still got same "obsolete conf" errors after adding 'use utf8;' after 'use strict;' (when using en_US.UTF-8 locale).
Please attach the config file you have. Thanks.
Created attachment 89575 [details] hpoj config file for HP OfficeJet K80 (USB) Original file location was /etc/ptal/mlc:usb:OfficeJet_K80
Smaller test case: echo abc | perl -ne 'use locale;print if /[^\s]+/' Actual output: (nothing) Expected output: abc
*** Bug 82799 has been marked as a duplicate of this bug. ***
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.
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.
Thanks, applied in hpoj-0.90-15.
*** Bug 87763 has been marked as a duplicate of this bug. ***
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.
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)
*** Bug 88956 has been marked as a duplicate of this bug. ***
Looks like this might be fixed in perl-5.8.1-0.pre19333.1.
Red Hat Enterprise Linux 3 has the problem too.
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.
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).
How about the actual perl bug causing the problem, with the test case in comment #5? (It works for me in Fedora Core 1).
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.)
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.
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).
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???!!!
It is important to remember that this is a perl bug, not a bug in hpoj.
This bug is fixed in all current Red Hat perl releases - closing out.