From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 6iigKQQE32aTQSUAWB0awg (envelope-from ) for ; Mon, 09 Sep 2024 10:19:48 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=O7jlQSND; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 909C51E353; Mon, 9 Sep 2024 10:19:48 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-12.8 required=5.0 tests=ARC_SIGNED,ARC_VALID, BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE,URIBL_BLOCKED, URIBL_DBL_BLOCKED_OPENDNS autolearn=ham autolearn_force=no version=4.0.0 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id ECCB31E08F for ; Mon, 9 Sep 2024 10:19:47 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7496C385DDDE for ; Mon, 9 Sep 2024 14:19:47 +0000 (GMT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 320CD3858C53 for ; Mon, 9 Sep 2024 14:19:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 320CD3858C53 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 320CD3858C53 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1725891568; cv=none; b=p9Ct1OGLz9Not2FFs0tiIRKviiKpyVFXsJrlJWC6kV9Vrle7Ei7X3OxHbk7trBxwSofP20voGnTzu8Mkv4EeKYVIibrRCElkL+a9VklRr+RQe1l8xes3TCtCFIyO6Ja8qCKdjAb/3dXeikpO831wW/b0yr6czzn681Gu+oi9/B8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1725891568; c=relaxed/simple; bh=K0kF3y9FzLwEI/10gafmat3EWdDltQqdkYY3bAfpq7k=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=nWTVXbqdBnHc62HKBGRwbVF/PKHI46/qr19AQK1MfqrwTksSgZ3NHswu/jqnvKLPMVoVVaS+JUebRaJVhB5MEr7Yf6FQzZo4eUv0f6Q9Z4ZmIwVbLAl4lUJy6dJshfHkW47GZ+aUUzdQ5aKhLYfrvRSbzUl4q4Ix9qNw9CvLqTc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725891562; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=xgK579mjpR0tLOS2pL0DazuK0L7Z4hMQozsAuJD2nbo=; b=O7jlQSNDwtP2/WbZBeJVu0izMQQGF6fR8zxEYMSLIMrkdBlOM5cYkMX59codMu4xTRCfqH flYYGFFVIGbjTKx0cO05wjZleI9JvHnu6ehdskNPNvf3LEP0yXsaeWKp7nRjKR7p5ubn9c OtCwtxkDH7b0BL0rTlvkfd5lmN21Or0= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-493-9_hobTXhMYS6ymIQa6cbZA-1; Mon, 09 Sep 2024 10:19:21 -0400 X-MC-Unique: 9_hobTXhMYS6ymIQa6cbZA-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-42cb236ad4aso11071885e9.3 for ; Mon, 09 Sep 2024 07:19:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725891560; x=1726496360; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=xgK579mjpR0tLOS2pL0DazuK0L7Z4hMQozsAuJD2nbo=; b=TD+MOvVstQKo72LHBoXegDsU09+MbYskKaaElh6gJLPWWnShZqmiwlb/nx+LSWl+sr Z0GUCSM3CxgS5+mP4frLoeF09851YWXPvzJPL2A1s0rurC+VGaAACKRHBv5n3GqhFhXI /6Tvbw+jJS6PzSyFbQ0tFgRXGuIX/ZQZlX8ZcgxRkQTu2P4Nbxl3Dx9I+29E8z29Qggo zakL4E/9OMcXjlAJ7FOCcya8qhn4F74+WXd7TpTvrfRwpk4bEDylcuo8Cbpip6FXac2P craOhO9ysZHR6NnWPnCN/VK4aSk/LyoXGggGxTnDbb819c9QHU8sFPCrliiC0Ix6rH+0 cNBQ== X-Forwarded-Encrypted: i=1; AJvYcCV020z0KCyg79L0h2b5WXyYnKKRIt0ujLa4JreQNKAj0oOo+QrHeCn2o/SCoOmrLuLnX/SAaG5iYlxqpg==@sourceware.org X-Gm-Message-State: AOJu0YzAbu8xw5BBxXw6YiUovEzxfEtRomXuTNlt/FFYN4sbo3D/63DV /HprGRQ7u5gzQMACsISxR/q7By50Z0GZGVnL+JhI6J409hK53TthhJiWtTt1YEHv2uAv96gJXa0 NrasojZGJU8Dlnk8MK8Ke9r9ycojL/s+xAGUMRx3zxXK4Iw6kHIc5Fbq8Iri7ohlOxFw= X-Received: by 2002:adf:e44c:0:b0:374:c40d:d444 with SMTP id ffacd0b85a97d-3789268e9abmr4806252f8f.19.1725891559798; Mon, 09 Sep 2024 07:19:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFExUClDsLbTvaXNC+im755HjzLr+tuQVGEaLTvuHTUqRkylYId0JjdClcsyNbhvKmjnHkSEw== X-Received: by 2002:adf:e44c:0:b0:374:c40d:d444 with SMTP id ffacd0b85a97d-3789268e9abmr4806214f8f.19.1725891558714; Mon, 09 Sep 2024 07:19:18 -0700 (PDT) Received: from localhost (178.126.90.146.dyn.plus.net. [146.90.126.178]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37895665108sm6143780f8f.28.2024.09.09.07.19.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Sep 2024 07:19:18 -0700 (PDT) From: Andrew Burgess To: Tom de Vries , gdb-patches@sourceware.org Subject: Re: [PATCH] [gdb/testsuite] Handle missing curses in gdb.python/py-missing-debug.exp In-Reply-To: References: <20240907033713.4483-1-tdevries@suse.de> <87frq9swxc.fsf@redhat.com> Date: Mon, 09 Sep 2024 15:19:17 +0100 Message-ID: <87zfogrjtm.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org Tom de Vries writes: > On 9/8/24 22:38, Andrew Burgess wrote: >> Tom de Vries writes: >> >>> On a system with python 3.6, module gdb.missing_debug imports module curses, >>> so when running test-case gdb.python/py-missing-debug.exp on a system without >>> that module installed, we run into: >>> ... >>> (gdb) source py-missing-debug.py^M >>> Python Exception : Module 'curses' is not installed.^M >>> Use:^M >>> sudo zypper install python36-curses^M >>> to install it.^M >>> Error occurred in Python: Module 'curses' is not installed.^M >>> Use:^M >>> sudo zypper install python36-curses^M >>> to install it.^M >>> (gdb) FAIL: gdb.python/py-missing-debug.exp: source python script >> > > Hi Andrew, > >> Do you know where the curses include is coming from? >> > > Yes, from gdb/python/lib/gdb/missing_debug.py: > ... > if sys.version_info >= (3, 7): > # Functions str.isascii() and str.isalnum are available starting Python > # 3.7. > def isascii(ch): > return ch.isascii() > > def isalnum(ch): > return ch.isalnum() > > else: > # Fall back to curses.ascii.isascii() and curses.ascii.isalnum() for > # earlier versions. > from curses.ascii import isalnum, isascii > ... Thanks for explaining this. I wonder if there's a way we could avoid that dependency... I'll have a think about that one. Thanks, Andrew > > Thanks, > - Tom > >> The py-missing-debug.py imports 'os' for os.rename and 'enum' for 'Enum' >> class. I'm guessing one of these, (maybe 'os' ?) is pulling in curses, >> but maybe there's something better we could use other than os.rename >> which would avoid this issue? >> >> If is 'os' that is pulling in 'curses', doesn't this feel like either >> the system was broken anyway, or the package dependencies are broken? >> >> Just curious to understand this better as I was a little surprised to >> see that curses was a dependency of this test. >> >> Thanks, >> Andrew >> >> >>> ... >>> >>> Fix this by issuing UNSUPPORTED instead, and bailing out. >>> >>> Tested on x86_64-linux. >>> >>> PR testsuite/31576 >>> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31576 >>> --- >>> gdb/testsuite/gdb.python/py-missing-debug.exp | 17 +++++++++++++++-- >>> 1 file changed, 15 insertions(+), 2 deletions(-) >>> >>> diff --git a/gdb/testsuite/gdb.python/py-missing-debug.exp b/gdb/testsuite/gdb.python/py-missing-debug.exp >>> index dfc0a467b2a..9d853d3a311 100644 >>> --- a/gdb/testsuite/gdb.python/py-missing-debug.exp >>> +++ b/gdb/testsuite/gdb.python/py-missing-debug.exp >>> @@ -58,8 +58,21 @@ with_test_prefix "initial checks" { >>> } >>> >>> # Load the Python script into GDB. >>> -gdb_test "source $remote_python_file" "^Success" \ >>> - "source python script" >>> +set python_script_loaded 0 >>> +set re_no_curses [string_to_regexp "Module 'curses' is not installed."] >>> +gdb_test_multiple "source $remote_python_file" "source python script" { >>> + -re -wrap $re_no_curses.* { >>> + unsupported $gdb_test_name >>> + } >>> + -re -wrap "^Success" { >>> + set python_script_loaded 1 >>> + pass $gdb_test_name >>> + } >>> +} >>> + >>> +if { ! $python_script_loaded } { >>> + return >>> +} >>> >>> # Setup the separate debug info directory. This isn't actually needed until >>> # some of the later tests, but might as well get this done now. >>> >>> base-commit: 4723415cda09b09dbac743f30f877355a49fdee2 >>> -- >>> 2.35.3 >>