[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250522094520.22zwevl6vgrjf3aw@vireshk-i7>
Date: Thu, 22 May 2025 15:15:20 +0530
From: Viresh Kumar <viresh.kumar@...aro.org>
To: "Sapkal, Swapnil" <swapnil.sapkal@....com>
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
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.
--
viresh
Powered by blists - more mailing lists