[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <76b4dd65-43a9-4d34-88bc-1632c08a9bb6@amd.com>
Date: Mon, 26 May 2025 14:22:08 +0530
From: "Sapkal, Swapnil" <swapnil.sapkal@....com>
To: Viresh Kumar <viresh.kumar@...aro.org>
CC: <rafael@...nel.org>, <shuah@...nel.org>, <gautham.shenoy@....com>,
<narasimhan.v@....com>, <linux-pm@...r.kernel.org>,
<linux-kselftest@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] selftests/cpufreq: Fix cpufreq basic read and update
testcases
Hi Viresh,
On 5/22/2025 3:15 PM, Viresh Kumar wrote:
> On 22-05-25, 14:07, Sapkal, Swapnil wrote:
>> Initially I tried the same, but it does not work properly with the root user.
>
> Hmm,
>
> Tried chatgpt now and it says this should work:
>
> if ! cat "$1/$file" 2>/dev/null; then
> printf "$file is not readable\n"
> fi
>
> - This attempts to read the file.
> - If it fails, the cat command returns non-zero, and you print a message.
> - 2>/dev/null suppresses error messages (Permission denied, etc.)
> - This works reliably for both root and non-root users, because it actually tests the read action, not just permission bits.
>
This looks clean. I will send v2 with this change.
--
Thanks and Regards,
Swapnil
Powered by blists - more mailing lists