Linux Power Management development
 help / color / mirror / Atom feed
From: "Sapkal, Swapnil" <swapnil.sapkal@amd.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: <rafael@kernel.org>, <shuah@kernel.org>, <gautham.shenoy@amd.com>,
	<narasimhan.v@amd.com>, <linux-pm@vger.kernel.org>,
	<linux-kselftest@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] selftests/cpufreq: Fix cpufreq basic read and update testcases
Date: Mon, 26 May 2025 14:22:08 +0530	[thread overview]
Message-ID: <76b4dd65-43a9-4d34-88bc-1632c08a9bb6@amd.com> (raw)
In-Reply-To: <20250522094520.22zwevl6vgrjf3aw@vireshk-i7>

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

  reply	other threads:[~2025-05-26  8:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-30 17:14 [PATCH] selftests/cpufreq: Fix cpufreq basic read and update testcases Swapnil Sapkal
2025-05-19  7:58 ` Viresh Kumar
2025-05-22  8:37   ` Sapkal, Swapnil
2025-05-22  9:45     ` Viresh Kumar
2025-05-26  8:52       ` Sapkal, Swapnil [this message]
2025-05-22 15:17   ` Shuah Khan
2025-05-26  8:46     ` Sapkal, Swapnil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=76b4dd65-43a9-4d34-88bc-1632c08a9bb6@amd.com \
    --to=swapnil.sapkal@amd.com \
    --cc=gautham.shenoy@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=narasimhan.v@amd.com \
    --cc=rafael@kernel.org \
    --cc=shuah@kernel.org \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox