From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2111.outbound.protection.outlook.com [40.107.94.111]) by sourceware.org (Postfix) with ESMTPS id D6400388CC1C for ; Mon, 7 Sep 2020 20:35:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D6400388CC1C ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RT8sarKm3cX66f3ryF3K5h23A5iKmH34EtImy4fD/Mfq+33GxLjFH96X9918vHQ6hfSDwwiiJb6fgsmCzdMQHar4VwJuMUWxvE+Rk85HtEtC/8Y9zZU61AN4Dr60/LsF5FrumZPPTuRI4T3d2I+JwQm1HJLUvP3SEDrXG7Ig0pFmhGNJHPEHr6MNAP3XxvHgllZ16G4qWFXzF4noPdLr2vjzUNpQ2iT7URgjLhBlnpvGrp/uR/2WLxY5NCTG1nJy9R9JmdiQI1WAf8i4bBy057HYS5PqG3uVeshOBKwXSL1Xiss/O/6KCvjDthT9RGg0Kari0zGUxq3zeVOdxNXkCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WnIskhqZgRjQYrQC4nwnNSUARpkM0mf5W2JMuSU5Q7U=; b=N0mR9eRHYSlCvucx1RKER8ArQFhAi5jLyOk/ZqBgm2N/PaQ7wZlPAY9j4oYaGpQ+Npc+QMWweJm3XiXqYepzG34vg9zSDwbOeOlt7REMq+gCy/m9Fw8nRvPfhWtL2QsM/s+SF3120tQ5K5RUim9N0VoZ/ibg5gKmzTLz/L8cxh2FmmpbMwKid6djjLAasQPeCbjssuNOjy4rltur1+bn/0dJwjI10pcJ/DK0gF6cNMg+y5ck7aQNqTMNzag3OSxlYmgqfPXHHR6OsussLLCVqAT5PIBo2VfnqMn4j9nY2e0G23C60IV+LcbEdpanOPkJgYonwOibRLvqeGyiKuA/+g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cornell.edu; dmarc=pass action=none header.from=cornell.edu; dkim=pass header.d=cornell.edu; arc=none Received: from MN2PR04MB6176.namprd04.prod.outlook.com (2603:10b6:208:e3::13) by MN2PR04MB6158.namprd04.prod.outlook.com (2603:10b6:208:d9::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3348.17; Mon, 7 Sep 2020 20:35:18 +0000 Received: from MN2PR04MB6176.namprd04.prod.outlook.com ([fe80::c144:d206:c369:af44]) by MN2PR04MB6176.namprd04.prod.outlook.com ([fe80::c144:d206:c369:af44%7]) with mapi id 15.20.3348.017; Mon, 7 Sep 2020 20:35:18 +0000 Subject: Re: ag 2 <(echo 2) gets assertion "p >= path" failed: .. /cygwin-3.1.7 ... /cygwin/path.cc", line 3065, function: int symlink_info::check To: cygwin@cygwin.com References: <26aedc53-30f2-d1a2-f9e8-c8a5dfa548c1@cornell.edu> <6c7185c9-f0a5-2b73-974f-04b55f8e6508@cornell.edu> From: Ken Brown Message-ID: Date: Mon, 7 Sep 2020 16:35:17 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 In-Reply-To: <6c7185c9-f0a5-2b73-974f-04b55f8e6508@cornell.edu> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-ClientProxiedBy: CH2PR12CA0026.namprd12.prod.outlook.com (2603:10b6:610:57::36) To MN2PR04MB6176.namprd04.prod.outlook.com (2603:10b6:208:e3::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [192.168.0.17] (68.175.129.7) by CH2PR12CA0026.namprd12.prod.outlook.com (2603:10b6:610:57::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3348.15 via Frontend Transport; Mon, 7 Sep 2020 20:35:18 +0000 X-Originating-IP: [68.175.129.7] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 10b921dd-f1d9-4db3-f6c3-08d8536d88e4 X-MS-TrafficTypeDiagnostic: MN2PR04MB6158: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cCuAJY5gpFhgIDzgChlNq6gQ8pz0h3x0jP/I3kmvOz5F9x39yH9z3wGTaPj/BE+2AsVInkS08NcIbT4DpGA5wAauGkgpuoBq4er7lH5HmPkguC0DVzQ8q4F57MXvozPfH0P4BvG8r72Q1nMRcXkc9ZNbgHUPzm8BUrKanK/no+QCKBAgBx0lmpq36ANEVOjeD6VxYP7EjPKjPr8EqBdbF8/4LpCrbBTHcnj5W4K0MnzsRAaWxD82NIqtYTexJ7+DgR35iEgoYir8fHI+AET9L25BHzL3deLvAjkEST6q75UefL1qp4RhMBmo91VSy+sJnlDNCGHvkkZsvTza4vXAMi4Q26B4VLh1S22U4p+sueaEiZuISa7IAboXJ2gLqThE7s1bKEFXV6yykYaIKn0hw7KaSkIZN7iJkcqNGcBUmYmfYdIv4V0Hj2nzkWMNwBgR X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR04MB6176.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(396003)(376002)(346002)(39860400002)(366004)(66556008)(66476007)(2616005)(83380400001)(26005)(956004)(6486002)(8676002)(75432002)(186003)(16526019)(66946007)(5660300002)(16576012)(86362001)(316002)(786003)(31696002)(478600001)(53546011)(52116002)(6916009)(2906002)(36756003)(8936002)(31686004)(43740500002)(460985005)(2480315003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: l+rqr/MUcP4Z4I+PlHCtPPtmJcg40LEpaFuegupctwU4zK6P0PhJE5juF6VTAXhrQ1/EQwNIcjjUPNOyjxbWSXh1kiLwumGI3tjR87hsS1EE1L2c7OtskXSIuEDwSHXzjnvBr7JQOHytxun2xK5wS1Hzj988tCgYSWAgMMX33mDFsgQGPsypRnacKQiOVJ3iXcI1wfVaWPfW8pQDjH2roSg69h4nDjNRhTZvqBmT5FPa4O6ivYaDtGdjnuHc3h2GrimU/kpvZ1/nLopUUaqRR6g0nF+T5oNuqrezhr5V+MvTk4peAWaVy2d5I+qe9TjfeZffXOEFmBqy75Yo6Uwrx21Tgb7lrM8lNOryXWi3RDEBkWZrLAy3tesIv/L7UXpMSeoVr3WhdBzjAF5pCwlvJBescP7nQ/kTpZlhmAzZvfQG6igSZHVrBVjumJoWNSjmd+keWTRzxYFcFlxLpYBD4FsXxfrdG6hudToHrrUg2Ddpcibdrz4xYRtvS4L1BiTjyRRShSGgMWD6cSL12xFRr56fh9eZKU+W/BAmL/bPR9r2nOZMQq6heD78StuPSQpF9BLb707AjwtyPvei9VZB5vnG97gcm2KmUbAWhUh1Jv3db3at41M0aHGMUFYm/Cfd3N7VCksevFGcnbygS1BeFg== X-OriginatorOrg: cornell.edu X-MS-Exchange-CrossTenant-Network-Message-Id: 10b921dd-f1d9-4db3-f6c3-08d8536d88e4 X-MS-Exchange-CrossTenant-AuthSource: MN2PR04MB6176.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2020 20:35:18.8271 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5d7e4366-1b9b-45cf-8e79-b14b27df46e1 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 5RlNX0ABTgtySzK6kIiHXlYA+gRxfEmq74XT/W0sHEgeWqOwT4TPDhN/CRjzYli6riCO0A/DuwKfNynp7cx4Qw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR04MB6158 X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_INVALID, DKIM_SIGNED, KAM_DMARC_STATUS, MSGID_FROM_MTA_HEADER, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2020 20:35:25 -0000 On 9/6/2020 4:28 PM, Ken Brown via Cygwin wrote: > On 9/6/2020 3:47 PM, Ken Brown via Cygwin wrote: >> On 9/6/2020 2:43 PM, David Dyck via Cygwin wrote: >>> This command triggers an assertion failure >>>    "ag" is from the_silver_searcher >>> >>> $ ag 2 <(echo 2) >>> assertion "p >= path" failed: file >>> "/home/corinna/src/cygwin/cygwin-3.1.7/cygwin-3.1.7-1.x86_64/src/newlib-cygwin/winsup/cygwin/path.cc", >>> >>> line 3065, function: int symlink_info::check(char*, const >>> suffix_info*, fs_info&, path_conv_handle&) >>> Aborted (core dumped) >>> >>>   3473k 2020/08/22 C:\cygwin64\bin\cygwin1.dll >>>      Cygwin DLL version info: >>>          DLL version: 3.1.7 >>> bash                                    4.4.12-3                        OK >>> the_silver_searcher                     2.2.0-1                         OK >> [...] >>> assertion "p >= path" failed: file >>> "/home/corinna/src/cygwin/cygwin-3.1.7/cygwin-3.1.7-1.x86_64/src/newlib-cygwin/winsup/cygwin/path.cc", >>> >>> line 3065, function: int symlink_info::check(char*, const >>> suffix_info*, fs_info&, path_conv_handle&) >>> Aborted (core dumped) >> [...] >>> I've reported this on github as an "ag" bug, but I think it is a bug in cygwin >> >> An assertion failure in Cygwin code is a Cygwin bug.  I'll take a look. > > Running > >   bash -c '/usr/bin/ag 2 <(echo 2)' > > under strace yields the following: > >   242  191767 [main] ag 33659 open: open(/dev/fd/63/.ignore, 0x0) > [...] >    30  192584 [main] ag 33659 mount_info::conv_to_win32_path: src_path > /proc/self/fd/63/.ignore, dst /proc/self/fd/63/.ignore, flags 0x0, rc 0 > [...] >    31  193366 [main] ag 33659 mount_info::conv_to_win32_path: > conv_to_win32_path (pipe:[4295036184]/.ignore) > [...] >    31  193550 [main] ag 33659 mount_info::conv_to_win32_path: > conv_to_win32_path (pipe:[4295036184]) > [...] >    34  193615 [main] ag 33659 symlink_info::check: 0xC0000034 = NtCreateFile > (\??\C:pipe:[4295036184]) > > The assertion fails because the path 'C:pipe:[4295036184]' doesn't contain a > backslash.  But probably we should never have allowed ourselves to get to the > point of considering that path. I've made some progress but haven't figured out the fix yet. First, for easier debugging, here's a simpler way to reproduce the problem: $ cat proc_bug.c #include #include #include #include int main () { int fd[2]; char fname[100]; if (pipe (fd) < 0) { perror ("pipe"); exit (1); } sprintf (fname, "/dev/fd/%d/foo", fd[0]); if (open (fname, O_RDONLY) < 0) { perror ("open"); exit (1); } } $ gcc -o proc_bug proc_bug.c $ ./proc_bug.exe assertion "p >= path" failed: file "../../../../newlib-cygwin/winsup/cygwin/path.cc", line 3065, function: int symlink_info::check(char*, const suffix_info*, fs_info&, path_conv_handle&) Aborted (core dumped) Here's what happens. The program is trying to open /dev/fd/3/foo, where file descriptor 3 is the read end of a pipe. path_conv check resolves this to /proc//fd/3/foo, creates an fhandler_process for this path, and calls (at path.cc:782) fhandler_process::exists. The latter fills the filebuf with "pipe:[xxxxxxxxxx]/foo" and returns virt_fsdir. We're now at path.cc:808, and everything is set up for the assertion failure. I think fhandler_process::exists is not doing the right thing here, but I'm not familiar with this part of the code, so I'll have to stare at it for a while to see what's going wrong. Corinna, if you are able to see it more quickly and want to go ahead and fix it, you won't hurt my feelings. Ken