Received: by 10.213.65.68 with SMTP id h4csp3927934imn; Tue, 3 Apr 2018 13:12:59 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+X4uYsOu1PGoH3WM8LXGosiFSpWamxp/zSKCVMs1q/73U5gjuwMeN+NXHkWl/aAhZtQjP+ X-Received: by 10.99.155.2 with SMTP id r2mr10210492pgd.450.1522786379321; Tue, 03 Apr 2018 13:12:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522786379; cv=none; d=google.com; s=arc-20160816; b=vNi0DLjNP5K41Z3PKRORUMp07gyyxUGoL/+LSYvxwiZflcAwSGF+ChsWt74jW//7uH EXWKoyaBpyBR2I+UzUb+fjzJFg/Hn0P+d2qIe3TN3XCb7cTkX7LKX6RTH+4Qe8mASmQg Avkt9QMdGRvRmEAeX+736duYsTkQFbVchBHZnw9ifiWwBipU6cGzySM9Yksf0sbPGSL5 rbaP9gXIWjrxqkn8FWLxEs+4sjH4Yviy0cjPc95VjMy/xjeMAIzDBmdahy3M87E2Qptq CadaRO5NNqqYJ78yCZoVSlvh8eP/Cube5qvR/dKN7yKzw9NUT49H3tvOKNLXvernoNS+ W4Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:date:cc:to:from:subject :message-id:arc-authentication-results; bh=R0e473vrmlTasCi6ht6myBM4/565ZAhnMl/DOA/8vYU=; b=P0qZ0lEMSYeCwqYSP8FAXdv1LYne09DzcZ5vFJEYQnwBVXv0w7pZb3qazCjXakJQ2N LoaiRwZppZmUvQVUhIqNMcQeUzR4RU9hTpUkBlNBnlESTQQOzyQG9tJGIY9uQ1pE7rma AXLerjfGoBrnmJtBWG2tfgZpuFINDhWuck89Ofaok5R8S25VK5APNWlv9f2cJ+hSDumd Z93wP5sWe8kz7r70yloD2idzCdZuLjEchJBko4s1IlCtoOctJTm/d6Ob1H+52gFOhs0M pNtv2F/cYXxAHLqRmJQEIPdfyuGb/HImJLrcwC6GCyoF6szwgOdkTuanEIdmAkhmvfeP JcBQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=codethink.co.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 9si2303983pge.750.2018.04.03.13.12.45; Tue, 03 Apr 2018 13:12:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=codethink.co.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753128AbeDCUKe (ORCPT + 99 others); Tue, 3 Apr 2018 16:10:34 -0400 Received: from imap1.codethink.co.uk ([176.9.8.82]:33149 "EHLO imap1.codethink.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752420AbeDCUKd (ORCPT ); Tue, 3 Apr 2018 16:10:33 -0400 Received: from 167-98-27-229.cust-167.exponential-e.net ([167.98.27.229] helo=xylophone) by imap1.codethink.co.uk with esmtpsa (Exim 4.84_2 #1 (Debian)) id 1f3SGF-00070w-KE; Tue, 03 Apr 2018 21:10:31 +0100 Message-ID: <1522786230.2654.124.camel@codethink.co.uk> Subject: Re: [PATCH] test_firmware: fix setting old custom fw path back on exit, second try From: Ben Hutchings To: "Luis R. Rodriguez" , Greg Kroah-Hartman Cc: Shuah Khan , linux-kselftest@vger.kernel.org, "linux-kernel@vger.kernel.org" Date: Tue, 03 Apr 2018 21:10:30 +0100 In-Reply-To: References: <20180403194849.csgzr3jllt4f2qb7@xylophone.i.decadent.org.uk> Organization: Codethink Ltd. Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.6-1+deb9u1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2018-04-03 at 12:54 -0700, Luis R. Rodriguez wrote: > On Tue, Apr 3, 2018 at 12:48 PM, Ben Hutchings > > wrote: > > Commit 65c79230576 tried to clear the custom firmware path on exit by > > writing a single space to the firmware_class.path parameter.  This > > doesn't work because nothing strips this space from the value stored > > and fw_get_filesystem_firmware() only ignores zero-length paths. > > > > Instead, write a null byte. > > > > Fixes: 0a8adf58475 ("test: add firmware_class loader test") > > Fixes: 65c79230576 ("test_firmware: fix setting old custom fw path back on exit") > > Signed-off-by: Ben Hutchings > > Thanks for the patch! Also can you re-send and address Greg and > linux-kernel ? There's significant changes to the firmware API on its > way to Linus to I think if we want to merge this it should go through > Greg at this point as he also merged some new changes I made to these > scripts. OK. > > --- > >  tools/testing/selftests/firmware/fw_filesystem.sh | 6 ++++-- > >  1 file changed, 4 insertions(+), 2 deletions(-) > > > > diff --git a/tools/testing/selftests/firmware/fw_filesystem.sh b/tools/testing/selftests/firmware/fw_filesystem.sh > > index f9508e1a4058..6b63b6bf2661 100755 > > --- a/tools/testing/selftests/firmware/fw_filesystem.sh > > +++ b/tools/testing/selftests/firmware/fw_filesystem.sh > > @@ -46,9 +46,11 @@ test_finish() > >                 echo "$OLD_TIMEOUT" >/sys/class/firmware/timeout > >         fi > >         if [ "$OLD_FWPATH" = "" ]; then > > -               OLD_FWPATH=" " > > +               # A zero-length write won't work; write a null byte > > +               printf '\000' >/sys/module/firmware_class/parameters/path > > +       else > > +               echo -n "$OLD_FWPATH" >/sys/module/firmware_class/parameters/path > > Odd I am pretty sure I tested this and it worked for me. Wonder what > it could have been... What shell are you using? I used bash. Seems to work the same way for me whether I use bash (interactive) or dash (script interpreter, /bin/sh). But there's no visual difference between " \n" and "\n"; that's why I used od to show a hex dump in my previous mail. Ben. >   Luis > > >         fi > > -       echo -n "$OLD_FWPATH" >/sys/module/firmware_class/parameters/path > >         rm -f "$FW" > >         rmdir "$FWPATH" > >  } > > -- > > 2.16.2 > > > > -- Ben Hutchings Software Developer, Codethink Ltd.