X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-6.8 required=5.0	tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL
X-Spam-Check-By: sourceware.org
Message-ID: <4F88CE32.1010908@cwilson.fastmail.fm>
Date: Fri, 13 Apr 2012 21:09:06 -0400
From: Charles Wilson <cygwin@cwilson.fastmail.fm>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: lpr printer name error; posix path to win32
References: <3185EFAF9C8F7B4E9DBDF56829BF7C782A43C20717@srv060ex01.ssd.fsi.com>
In-Reply-To: <3185EFAF9C8F7B4E9DBDF56829BF7C782A43C20717@srv060ex01.ssd.fsi.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

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

