X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F3DEF3951822 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1599593188; bh=TNS+rKtd+C85XrsZzd7StL1SOpf3GTeS7S0rGE4cQ3M=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=WrPmgBSGcoCyiNrHbjP69eFGWEP3n1KWTo7waKmX7kq2+NHDMmcnmOJda3D4DCuuM gi5sUtWoGZh0vYFujEHKKeWuSN+KvSvTQdVq9dUn2cz43xxJx2pEfiuWArnxIRXzjs sFh0U1KnrZEY6H7J4jl4fJi6bHKp12i4D+08cSsY= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0E28F385783A ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X3RrD5QYvy5wam+A61iaPlhsnjGFiDjvXhR68cSZDptT9GH+qw7taCFcufqFHtXOjsinYPf5v++a9TTrDKZers/WiM6hDspwnDCYuMAN9Q8FiLDhKEbqN1dnireplJ8oya6hE9qMQiBqYGkYXzPBHf3I2/LLQ58YHDPisR1QXzNMgCSol9XOGx9svGVDFSdYP9mX/Ug2cwSqUfih9X1qknKJlQV5MmP5gX5cK4A93IgBEcPTJC7YooEJOujodlVQQbiilJIWYEdYRilCmxswMRhxowWZ7n3x0pmMdpcvvJiF/eZgd0P0OGsGN185uvvdGbBwzJTU8zA/gqXRiwf6NA== 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=jIpAkGCL2JyugL6kLv3iZaASnYX6ybOfpnMMEszA6N8=; b=LNsoGfOhyXsVZsfTym4shoOpCJt9odOOgsumxOGJtNiidvLxq9mL3OOgIS7gTPAO+aKTdza8B8F8RVHkYlwlXQujk1uSFfCA5d60Q+QowaofTB1PVf//qQwOOLDKRW7BP5HBs9tDBj33SXfgdEOEj00pWbAuNrNfdx7KZnRO7myxEZtI67VwfPtzqA6B9qj7T/igqa1QCso+y3XwuxXDW02PlIePqR97EtKph+ZzDSfqomY5UGrkyNWsYMLE9tWnvqJLZat+6aBCytE4luKt0k2Vyd3CeLxpRfHH+bQp20jlKFoNmGPJ5+LImxB55oHVKx3dMXZlfHZgScTM+hgNfQ== 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 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 AT cygwin DOT com References: <26aedc53-30f2-d1a2-f9e8-c8a5dfa548c1 AT cornell DOT edu> <6c7185c9-f0a5-2b73-974f-04b55f8e6508 AT cornell DOT edu> Message-ID: <0ed7b3f0-7e2b-eb28-596b-6dcba9ee51dd@cornell.edu> Date: Tue, 8 Sep 2020 15:26:22 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 In-Reply-To: Content-Language: en-US X-ClientProxiedBy: CH2PR18CA0030.namprd18.prod.outlook.com (2603:10b6:610:4f::40) To MN2PR04MB6176.namprd04.prod.outlook.com (2603:10b6:208:e3::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [IPv6:2604:6000:b407:7f00:fc34:902a:527a:1c90] (2604:6000:b407:7f00:fc34:902a:527a:1c90) by CH2PR18CA0030.namprd18.prod.outlook.com (2603:10b6:610:4f::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3348.16 via Frontend Transport; Tue, 8 Sep 2020 19:26:23 +0000 X-Originating-IP: [2604:6000:b407:7f00:fc34:902a:527a:1c90] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2b802b2a-2727-4a9e-c680-08d8542d12aa X-MS-TrafficTypeDiagnostic: MN2PR04MB5568: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Hh8T5d8YpmMrs4TcGS7PHbeuNZcus/35CGKG3xrwaAIQjTfYC9z0DUPRfZTCVh6UhZhYrvXtwmOgHcnqbad2qZ8jExYOW8BEbVphCZRi0pkhorbs6AFjlO2R4qJP3zZO7RNxwtakTlUO2eoVpNfuQt2MvNk24TgaspTP4jpooLOsXRbc9iVero9rX74g8fvxb4vfzk9Hr/AXbqnN59/FR07u7pXH3EtwPGeWLki6+LsI6edLEfbI3Jj7roWlQ5oNt3kX4N+tgRHQ0Vgn4xeMdl4+teFiBOJQ80UZPfK4TZ5ZNua+EZUzS9VWCfPOCZTz0okypfzd+fOfWvDEB8usnbUGkxtebvIIFGL7u/G/apKW0jHMSY2EuvLJkCs9tA7WG7Q7XoyeoQjQ4xAas1sP8A== 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)(376002)(396003)(39860400002)(366004)(346002)(316002)(6486002)(478600001)(786003)(66556008)(8936002)(66476007)(66946007)(31686004)(186003)(8676002)(86362001)(4326008)(75432002)(2616005)(5660300002)(6916009)(36756003)(2906002)(53546011)(83380400001)(52116002)(31696002)(16526019)(43740500002)(460985005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: BLvPXRT+z3iVC9zOqSoU0frucgdI6CTmQaYpodbdA5jwPrsV5bPUp0NSxwSdfuxcV7uwwf+bWMlityuh8I5ZzDGobsQ2DfSex7VTEdMlfzezEwMtw+of01nQ9P9Vt1jPFOr+es2peqh+zBfPPuW7UuVMLZtJd8n2hfzkqrV2ejcw974YjhfUhYQGA2kmmGtGN/vKLwOHPuBabLtk4dyRWCEefpRpwQSA8jr2oPh6vfeo4v2/AKPx6RDpwNGIQB/G+KC+D3PVfTv6gZrzsiqFNSREdlyuer/JiklFKzTBrb3QWO3V0weXu/QBq2Uny4ugmtBVd3USUxGq6ooAyqSKHrG9FQKQ2GoN6oFVrg61likY6EAPvllu/YCcz+1X9zWC9u7GyAP8+eTikhwM6dx+tMccp8XATsuNqu3/27QPdcNh/UYN0YM30OHLIedp1jIdq3vapAOLWIjGqz5SPwkYKmaBrVjhmJSxwggyq/knsW/WuUT7SPA4l5HbUuHjN2NkFNyiR0TuujvixdIEt3qKFrEnNAdPPuCICUNFIU0C+8fwQcdIcffg/2omrQ7MytM9l8nAadfkTwdfd9EvDxek8minA6tL/E4gmCeD41dw0Rc2uTUagWtyFoIt7ZJBMgqqYG2dDiILJnqeoSc3lGwFNf1/yb3aoNJKgno7PJr3HzZo3KeejW7HI8kxKn3Da99osPa7N5Ae3cPs33E4Ya5jYA== X-OriginatorOrg: cornell.edu X-MS-Exchange-CrossTenant-Network-Message-Id: 2b802b2a-2727-4a9e-c680-08d8542d12aa X-MS-Exchange-CrossTenant-AuthSource: MN2PR04MB6176.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Sep 2020 19:26:23.8227 (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: CMu+FzlwsSzIL/bMEyyy5xf3fNAqVwCz5mOnNEDf9WS5/y2hyziOG8ld/j8j3CWvIqteZTHiwprrRzGjm/bCTA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR04MB5568 X-Spam-Status: No, score=-0.8 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 AT cygwin DOT 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: , From: Ken Brown via Cygwin Reply-To: Ken Brown Content-Type: text/plain; charset="windows-1252"; Format="flowed" Errors-To: cygwin-bounces AT cygwin DOT com Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id 088JQsgJ031948 On 9/7/2020 4:35 PM, Ken Brown via Cygwin wrote: > 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. This is now fixed. David, you can test it as soon as Corinna has a chance to make a new Cygwin snapshot. Thanks for reporting the problem. Ken -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple