Skip to content

Commit ce218ff

Browse files
committed
set_permissions noread requires setPermissions
1 parent 4123ef1 commit ce218ff

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

+stdlib/+native/set_permissions_legacy.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
[s, msg, id] = fileattrib(file, mode);
3131
ok = s == 1;
3232
if ~ok
33-
warning(id, "Failed to set permissions for %s: %s", file, msg)
33+
warning(id, "Failed to set permissions %s for %s: %s", mode, file, msg)
3434
end
3535

3636
end

test/TestPermissions.m

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,21 @@ function test_get_permissions(tc, Ps)
3333
end
3434

3535

36-
function test_set_permissions_noread(tc, sp_fun)
36+
function test_set_permissions_noread(tc)
3737
import matlab.unittest.constraints.StartsWithSubstring
38-
is_capable(tc, sp_fun)
3938

40-
tc.assumeFalse((ispc() && isMATLABReleaseOlderThan('R2025a')) || isMATLABReleaseOlderThan('R2022a'))
39+
% This ONLY works with the new setPermissions.
40+
% fileattrib can not even set the permissions on Linux.
41+
tc.assumeFalse(isMATLABReleaseOlderThan('R2025a'))
4142
td = tc.createTemporaryFolder();
4243

4344
nr = fullfile(td, "no-read");
4445

4546
tc.verifyTrue(stdlib.touch(nr))
46-
tc.verifyTrue(sp_fun(nr, -1, 0, 0))
47+
tc.verifyTrue(stdlib.set_permissions(nr, -1, 0, 0))
4748
p = stdlib.get_permissions(nr);
4849

49-
if ~ispc() || ~endsWith(func2str(sp_fun), "legacy")
50+
if ~ispc()
5051
tc.verifyThat(p, StartsWithSubstring("-"), "no-read permission failed to set")
5152
end
5253

0 commit comments

Comments
 (0)