This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: lpr printer name error; posix path to win32


On 4/13/2012 5:42 PM, Rockefeller, Harry wrote:
A week ago I was able to print using lpr filename.
But it has been broken for a few days now.
I have been looking at this month's archive and have not seen
any discussion on this.

Before the latest cygutils was released I got an error that said
printer name 'garbage characters' doesn't exist.

After updating to cygutils-1.4.10-1 today the error message has changed (See below).

I think this is because lpr.cc has long (erroneously) used
cygwin_conv_to_win32_path()
to "convert" an SMB shared printer name (//server/printer) represented with forward slashes into the same name represented with backslashes. It may not be true with modern windows, but in the past IIRC the win32 print interface was finicky about that.


However...cygwin_conv_to_win32_path() is really a giant hammer for a very small nail. Actually, it's the wrong tool entirely, because
$PRINTER='Brother HL-5250DN (direct)'
is not a *path* at all; it's a name.


In the latest cygutils release, I (rather blindly, I admit) replaced the call to the deprecated cygwin_conv_to_win32_path() function with a call to the cygwin-1.7-compliant cygwin_create_path(). However, I made two mistakes:

1) I forgot to use the CCP_RELATIVE conversion flag, so the new call "absolutized" the printer name, by treating it as a filename in the current directory -- unless it was of the //server/printer form (which already looks like an absolute path).

2) I should have simply removed the cygwin_conv_* call, and used the appropriate tool -- which in this case is to check if the printer name matches '//server/printer' and ONLY then, simply 'normalize' the slashes (in case win32 Print still cares about that). (oh, and watch out for 'servers' that look like 'http:' and 'file:'; don't 'normalize' those).

I'll roll out a new -2 release soon.

--
Chuck

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]