From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8100 invoked by alias); 12 Dec 2016 19:28:41 -0000 Mailing-List: contact cygwin-developers-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-developers-owner@cygwin.com Mail-Followup-To: cygwin-developers@cygwin.com Received: (qmail 8081 invoked by uid 89); 12 Dec 2016 19:28:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.4 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=no version=3.3.2 spammy=Hx-languages-length:1655, Hx-spam-relays-external:sk:mrelaye, H*RU:sk:mrelaye, H*r:sk:mrelaye X-HELO: mout.kundenserver.de Received: from mout.kundenserver.de (HELO mout.kundenserver.de) (212.227.17.10) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 12 Dec 2016 19:28:30 +0000 Received: from [192.168.178.45] ([95.91.244.94]) by mrelayeu.kundenserver.de (mreue102 [212.227.15.183]) with ESMTPSA (Nemesis) id 0LjaQK-1cnN7C0jFo-00bZHV; Mon, 12 Dec 2016 20:28:26 +0100 Subject: Re: cygwin_create_path causes null pointer crashes To: cygwin-developers@cygwin.com References: <4cdcdf06-6018-0854-002f-8ca92a2b3698@towo.net> <20161211110806.GA22664@calimero.vinschen.de> From: Thomas Wolff Message-ID: <3a85ca92-2959-9963-1934-4e3f4e448cf1@towo.net> Date: Mon, 12 Dec 2016 19:28:00 -0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20161211110806.GA22664@calimero.vinschen.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-UI-Out-Filterresults: notjunk:1;V01:K0:QZOTr0x7o+I=:MPrVxFK12PjxSACMRSNy6A BN2hmsbr81QIlsgVa/PWbLHE4VknIbJwAOBgvgL8733AjLDX9UMpEMTm9C0iZ4C/IhRANJmxE n1rxgu8JXbqdcP5j8sKq+xYRM0fkUANyCuECiVrcoz4RY6R225kaPLeOKx5KHMxgb8BFR1LF5 nIf8CfzXdVMQQvytglT7QjjCANTL+QmeOMtgjmk5doERAuiwv3XEVMLAkhN3KVTIdJV6J6BuO Es8IQO4cNBBBZDR3/i2auGJ2PLLsyfT8bALJsd7AA3kBS9Lu5HgTXGZhdy98lDFtbcHAgRUNH CGfUNu5zWlN37kIHVdPkBPNEg9TzDEPuAzWNDmB+KCz1+vXjPkOoULyerHiDZybsS+iv/+eGv pQO+1LhiLboGKfm/gciISR1KTxzBuCGLA3/Wl7y3H5EDTiLHxIFAsVk3GrVKAMtqT8HdySULZ nVl1R9VdukpXHCkUs/dAW0k5fBX3UxE9qnD+3XE1nKcTG6ZcT2HOSNRDWnujxCCb0a6redw3g YCUM+wMCkEobzMPzV2ECN5unHz0N1gXqtMIOpZtgWNeYGV7tab6cw98l8th2B8Mx7FUPZ+0WR Cc9uPJ36F2YniHzFBCVwC4bwSJI3lnCTE/Tp9RIF5mgXGHwzeiLCQXUz8MjbrC+asuR11mNH4 eVTBS9ZnyY7NwpGOmzzRUro2iOjC7ZELMBU2HeqmGzGwCJUhpaT0kNjnJ6iEy5C3ucfQ1GUc2 Gtjy1iEXHOeFnGmo X-IsSubscribed: yes X-SW-Source: 2016-12/txt/msg00010.txt.bz2 Hi Corinna, Am 11.12.2016 um 12:08 schrieb Corinna Vinschen: > Hi Thomas, > > On Dec 10 03:03, Thomas Wolff wrote: >> cygwin_create_path is supposed to call malloc itself, >> however, it occasionally returns with null and errno == ENOSPC, >> if it's provided with a network path, e.g. >> cygwin_create_path(CCP_POSIX_TO_WIN_W, "/cygdrive/s/.config/mintty") >> returns null in ~ 3 of 1000 cases, where /cygdrive/s exists but >> /cygdrive/s/.config does not > Did you try to debug and fix the issue? This is the developer's mailing > list after all... I can contribute some initial analysis: Cloning cygwin_create_path from cygwin/path.cc with these essentials: ssize_t size = cygwin_conv_path (what, from, NULL, 0); // checking size, calling malloc if (cygwin_conv_path (what, from, to, size) == -1) ... there are actually two different errors happening, with example path "/cygdrive/s/.config/mintty": 1. the first call (for size determination) returns 44 but the second call returns the correct result "S:\.config\mintty". 2. the first call returns 36 but the second call (provided with a larger size value patched into the function) returns "S:\.config\mintty.lnk" (which needs 44 bytes); this is obviously the call that would return null if not patched with a faked buffer size Another observation, by the slowness of the calls, is that apparently the drive is actually accessed during the path conversion, which I wouldn't have expected from a plain path conversion function. The underlying function cygwin_conv_path looks a bit complicated for a straight-forward analysis to me... ------ Thomas