From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id F1929385781F for ; Wed, 4 Oct 2023 15:47:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F1929385781F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696434444; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mZMk7BMJfOsEmvtbvk0ObY8EWJ5ApMpxPEvW1TgJkMw=; b=BIwTLysPZOm2l/Q4DqajsJEqLRh00GByb79joS9UxrOnAPbr6BUIdG4gfXS7Qz0Zp0jH8h YYXLlOxQ6CI5/ibWcdk2etIqCgjfHOvGQ57kHqLk93HQo5J9yXcEVFLIU0/hI9ntKfHbSz c8ilV8MVwX7VD8KyipMTtIBLrzQPtDY= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-499-Wfal_9KqNxu2ZPf-uYCowA-1; Wed, 04 Oct 2023 11:47:23 -0400 X-MC-Unique: Wfal_9KqNxu2ZPf-uYCowA-1 Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-9b98d8f6bafso14532666b.1 for ; Wed, 04 Oct 2023 08:47:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696434442; x=1697039242; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mZMk7BMJfOsEmvtbvk0ObY8EWJ5ApMpxPEvW1TgJkMw=; b=fet/G29JFuN8Gx3WmKDdTHGSnxY61geDGVfD7ktt9RP/F/xEo+CWBWKhZrc5+mC7Qa XKbbs0LnazKThr2Q6+K/FCBcdRDAvEO+PSVn/OQcdalgp2gQ0Tn+5KNyUmUQRGtrcZEc krG7o+5UhgH973kNy7zzZIicLCkxEYXd/PR9RV9r84h5tVddp9qVZ2lHNg+gE7A9l8Bj lKTh1HgOvfLpxU91RO/4Aw1C4RrVnvqluXCjBIp4jufTW7yxqsqXZpOhcUqe1A11SEZi kyjGtwEY6iTV7POGibExTmIJkdircz9XIN1x/RpUSOGuy4k+gIWr55u1yZ1CGwkDvcmf bobQ== X-Gm-Message-State: AOJu0YzpGfwzN0omVzGsuWqG41H6aZmbtv0wOe66mZ4uqA+x8etFCO4u 6TtBi/H/Lw3mqNoAouyh4QSNMtmdU07gUvurVFOzKpPrSGFNs0NHNXy5olXSjND7kJSYjgKWlvY V8esacHWEPsc3T4zrXJh+XuQOMw4inQ== X-Received: by 2002:a17:906:3e52:b0:9b2:aa2f:ab69 with SMTP id t18-20020a1709063e5200b009b2aa2fab69mr2710623eji.30.1696434441979; Wed, 04 Oct 2023 08:47:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGGoWNDoAuEKSSmSzmY2tE2Gk4dUB8T0HlSt/zMfJFC0sVn2sQyQk3pn+2ukjeahsgrJWP0Uw== X-Received: by 2002:a17:906:3e52:b0:9b2:aa2f:ab69 with SMTP id t18-20020a1709063e5200b009b2aa2fab69mr2710606eji.30.1696434441664; Wed, 04 Oct 2023 08:47:21 -0700 (PDT) Received: from [192.168.0.129] (ip-94-112-227-180.bb.vodafone.cz. [94.112.227.180]) by smtp.gmail.com with ESMTPSA id l1-20020a170906078100b009ae0042e48bsm2996416ejc.5.2023.10.04.08.47.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Oct 2023 08:47:21 -0700 (PDT) Message-ID: Date: Wed, 4 Oct 2023 17:47:20 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v3] gdb/testsuite: XFAIL some gdb.base/fileio.exp To: Tom de Vries , gdb-patches@sourceware.org References: <20230814102449.203616-2-blarsen@redhat.com> <20231004140247.16091-2-blarsen@redhat.com> From: Guinevere Larsen In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.8 required=5.0 tests=BAYES_00,BODY_8BITS,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_BARRACUDACENTRAL,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 04/10/2023 17:33, Tom de Vries wrote: > On 10/4/23 16:02, Guinevere Larsen via Gdb-patches wrote: >> diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp >> index de22da8d8a8..5b90b8af3b8 100644 >> --- a/gdb/testsuite/lib/gdb.exp >> +++ b/gdb/testsuite/lib/gdb.exp >> @@ -9981,5 +9981,25 @@ gdb_caching_proc have_system_header { file } { >>       return [gdb_can_simple_compile have_system_header_$name $src >> object] >>   } >>   +# Return 1 if the test is being run as root, 0 otherwise. >> + >> +gdb_caching_proc root_user {} { >> +    # ID outputs to stdout, we have to use exec to capture it here. >> +    set user [remote_exec target id] >> + >> +    regexp -all "(-?\[0-9\]+).*" $user user ret_val > > I can see that this works, but it's a bit unusual (and hard to parse > for me) to use regexp to pick apart a list. The usual way is using > lindex. That's a good point. TCL lists confuse me a lot, and the original plan was to have this along with the uid picking part but that failed for other reasons when the command failed. > >> + >> +    # If ret_val is not 0, we couldn't run `id` on the target for some >> +    # reason.  Return that we are not root, so problems are easier to >> +    # spot. >> +    if {[expr $ret_val != 0]} { > > The expr is not necessary here. > >> +    return 0 >> +    } >> + >> +    regexp -all ".*uid=(\[0-9\]+).*" $user user uid >> + > > Also, the 'user' variable is used as dummy, better make that explicit. > > So, please do: > ... >     set res [remote_exec target id] >     set ret_val [lindex $res 0] >     set output [lindex $res 1] > >     # If ret_val is not 0, we couldn't run `id` on the target for some >     # reason.  Return that we are not root, so problems are easier to >     # spot. >     if { $ret_val != 0 } { >         return 0 >     } > >     regexp -all ".*uid=(\[0-9\]+).*" $output dummy uid > >     return [expr $uid == 0] > ... > > Approved with that change. Thanks! I applied your change and pushed it. -- Cheers, Guinevere Larsen She/Her/Hers > > Approved-By: Tom de Vries > > Thanks, > - Tom > > >> +    return [expr $uid == 0] >> +} >> + >>   # Always load compatibility stuff. >>   load_lib future.exp >