Skip to content

Commit

Permalink
BR-6654: Fix mkdir_mask test
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Vlasov committed Aug 14, 2019
1 parent 2f16818 commit b2072a6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 46 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ Configuration parameters

php.ini parameters for shadow. Default is fine for most cases.

| Name | Default | Meaning |
|--------------------|---------|------------------------------------------------------|
| shadow.enabled | 1 | Shadowing enabled? |
| shadow.mkdir\_mask | 0755 | Mask used when creating new directories on instances |
| shadow.debug | 0 | Debug level (bitmask) |
| shadow.cache\_size | 10000 | Shadow cache size (in bytes, per process) |
| Name | Default | Meaning |
|--------------------|---------|-----------------------------------------------------------------|
| shadow.enabled | 1 | Shadowing enabled? |
| shadow.mkdir\_mask | 0755 | Mask used when creating implicitly new directories on instances |
| shadow.debug | 0 | Debug level (bitmask) |
| shadow.cache\_size | 10000 | Shadow cache size (in bytes, per process) |

Debug level
-----------
Expand Down
54 changes: 14 additions & 40 deletions tests/write_new_mask.phpt
Original file line number Diff line number Diff line change
@@ -1,66 +1,40 @@
--TEST--
Check writing to files in new dir with dir mask
Check directory mask on instance directory
--INI--
shadow.mkdir_mask=0755
shadow.mkdir_mask=0777
--SKIPIF--
<?php if (!extension_loaded('shadow')) {
print 'skip';
} ?>
<?php if (exec('whoami') == 'root') {
print 'skip';
} ?>
--XFAIL--
nrh: 20150605: We belive this feature to be unimplemnted, see CRYS-959
--FILE--
<?php
require_once 'setup.inc';

chdir($template);
umask(0);

mkdir("txt/new/");
mkdir("txt/new/dir/");
file_put_contents("txt/new/dir/_twrite.txt", "writing as template\n");

mkdir("txt/new2/");
mkdir("txt/new2/dir/");
ini_set('shadow.mkdir_mask', '0700');
file_put_contents("txt/new2/dir/_twrite.txt", "writing as template\n");
mkdir("txt/new2/dir7000/");
touch('non-existing/test.txt');

clearstatcache();

$stat = stat("txt/new/dir/");
$stat = stat($instance . '/non-existing/');
echo substr(decoct($stat['mode']), -5) . PHP_EOL;

$stat = stat("txt/new/");
echo substr(decoct($stat['mode']), -5) . PHP_EOL;
unlink('non-existing/test.txt');
rmdir($instance . '/non-existing/');

$stat = stat("txt/new2/dir/");
echo substr(decoct($stat['mode']), -5) . PHP_EOL;
ini_set('shadow.mkdir_mask', '0700');

$stat = stat("txt/new2/");
echo substr(decoct($stat['mode']), -5) . PHP_EOL;

$stat = stat("txt/new2/dir7000/");
echo substr(decoct($stat['mode']), -5) . PHP_EOL;
touch('non-existing/test.txt');

clearstatcache();

unlink("txt/new/dir/_twrite.txt");
rmdir("txt/new/dir");
var_dump(rmdir("txt/new"));
$stat = stat($instance . '/non-existing/');
echo substr(decoct($stat['mode']), -5) . PHP_EOL;

unlink("txt/new2/dir/_twrite.txt");
rmdir("txt/new2/dir7000/");
rmdir("txt/new2/dir");
var_dump(rmdir("txt/new2"));
unlink('non-existing/test.txt');
rmdir($instance . '/non-existing/');
?>
--EXPECT--
40755
40755
40755
40755
40755
40777
40700
bool(true)
bool(true)

0 comments on commit b2072a6

Please sign in to comment.