php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #49175 mod_files.sh patch
Submitted: 2009-08-06 02:51 UTC Modified: 2013-06-28 21:11 UTC
Votes:4
Avg. Score:3.5 ± 0.9
Reproduced:3 of 3 (100.0%)
Same Version:3 (100.0%)
Same OS:3 (100.0%)
From: oorza2k5 at gmail dot com Assigned:
Status: Closed Package: Session related
PHP Version: 5.5.0 OS: *nix
Private report: No CVE-ID: None
 [2009-08-06 02:51 UTC] oorza2k5 at gmail dot com
Description:
------------
here's a script, mod_files.sh, in ext/session for creating directory
tree with depth X for sessions.  As it stands, it's pretty poorly
documented and very basic.  I got exceptionally bored and rewrote most
of it, the patch is attached.  It runs fine for me in linux (with sh
version 4.0).  I don't have any other *NIX systems to test it out on,
so I can't verify that it works in anything but linux, sorry.

What I changed:

1. Usage now properly reflects arguments, and is better explained.
2. Will create directory given if it doesn't exist
3. Will hop into interactive select if directory already has contents
4. Switched from "test" to "[[ ]]" as it's easier to read and _should_
be just as supported.

Reproduce code:
---------------
Patch is available at

http://pastebin.ca/1520039



Expected result:
----------------
(Old behavior)

$ sh mod_files.sh
usage: mod_files.sh basedir depth

$ sh mod_files.sh /foo 3
mod_files.sh: line 13: test: : integer expression expected
mkdir: cannot create directory `/foo/0': No such file or directory


Actual result:
--------------
(New behavior)

$ sh mod_files.sh
Usage: mod_files.sh BASE_DIRECTORY DEPTH MAJOR_PHP_VERSION
BASE_DIRECTORY will be created if it doesn't exist
DEPTH must be an integer number >0
MAJOR_PHP_VERSION should be one of 4, 5, or 6

$sh mod_files.sh /foo 3 5
Directory /foo is not empty! What would you like to do?
1) Delete directory contents  3) Quit
2) Choose another directory
#? 1
Deleting /foo contents...
Creating session path in /foo with a depth of 3 for PHP Version 5.X


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-11-24 15:00 UTC] jani@php.net
-Summary: ext/session: mod_files.sh patch +Summary: mod_files.sh patch -Package: Feature/Change Request +Package: Session related
 [2010-12-21 01:36 UTC] mastermind dot ua at gmail dot com
The last parameter to mod_files.sh is not a MAJOR_PHP_VERSION but a number of bits used for hashing:

session.hash_bits_per_character integer
    session.hash_bits_per_character allows you to define how many bits are stored in each character when converting the binary hash data to something readable. The possible values are '4' (0-9, a-f), '5' (0-9, a-v), and '6' (0-9, a-z, A-Z, "-", ","). 

http://www.php.net/manual/en/session.configuration.php#ini.session.hash-bits-per-character
 [2013-06-28 21:11 UTC] yohgaki@php.net
-Status: Open +Status: Feedback -PHP Version: 5.3.0 +PHP Version: 5.5.0
 [2013-06-28 21:50 UTC] yohgaki@php.net
Automatic comment on behalf of yohgaki
Revision: http://git.php.net/?p=php-src.git;a=commit;h=5f0656b89ddb42d17a70f767060a08226809421a
Log: Fixed bug #49175: mod_files.sh does not support hash bits
 [2013-06-28 21:50 UTC] yohgaki@php.net
-Status: Feedback +Status: Closed
 [2013-06-29 00:11 UTC] yohgaki@php.net
Automatic comment on behalf of yohgaki
Revision: http://git.php.net/?p=php-src.git;a=commit;h=27b01cfcd7d26e4c6ae616733fbdae33ecbe494e
Log: Fixed bug #49175: mod_files.sh does not support hash bits
 [2013-06-29 00:48 UTC] yohgaki@php.net
Automatic comment on behalf of yohgaki
Revision: http://git.php.net/?p=php-src.git;a=commit;h=27b01cfcd7d26e4c6ae616733fbdae33ecbe494e
Log: Fixed bug #49175: mod_files.sh does not support hash bits
 [2013-06-29 00:48 UTC] yohgaki@php.net
Automatic comment on behalf of yohgaki
Revision: http://git.php.net/?p=php-src.git;a=commit;h=520c08adf08a0e6d7dfeb5a7d5f3d02fb205c33a
Log: Fixed bug #49175: mod_files.sh does not support hash bits
 [2013-06-29 02:38 UTC] yohgaki@php.net
Automatic comment on behalf of yohgaki
Revision: http://git.php.net/?p=php-src.git;a=commit;h=ef63334fa6d0e51d3235b8a026da1316e89b08ce
Log: Fixed bug #49175: mod_files.sh does not support hash bits
 [2013-07-02 06:26 UTC] ab@php.net
Automatic comment on behalf of yohgaki
Revision: http://git.php.net/?p=php-src.git;a=commit;h=ef63334fa6d0e51d3235b8a026da1316e89b08ce
Log: Fixed bug #49175: mod_files.sh does not support hash bits
 [2013-11-17 09:30 UTC] laruence@php.net
Automatic comment on behalf of yohgaki
Revision: http://git.php.net/?p=php-src.git;a=commit;h=27b01cfcd7d26e4c6ae616733fbdae33ecbe494e
Log: Fixed bug #49175: mod_files.sh does not support hash bits
 [2013-11-17 09:30 UTC] laruence@php.net
Automatic comment on behalf of yohgaki
Revision: http://git.php.net/?p=php-src.git;a=commit;h=5f0656b89ddb42d17a70f767060a08226809421a
Log: Fixed bug #49175: mod_files.sh does not support hash bits
 [2013-11-17 09:30 UTC] laruence@php.net
Automatic comment on behalf of yohgaki
Revision: http://git.php.net/?p=php-src.git;a=commit;h=520c08adf08a0e6d7dfeb5a7d5f3d02fb205c33a
Log: Fixed bug #49175: mod_files.sh does not support hash bits
 [2014-10-07 23:18 UTC] stas@php.net
Automatic comment on behalf of yohgaki
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=ef63334fa6d0e51d3235b8a026da1316e89b08ce
Log: Fixed bug #49175: mod_files.sh does not support hash bits
 [2014-10-07 23:29 UTC] stas@php.net
Automatic comment on behalf of yohgaki
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=ef63334fa6d0e51d3235b8a026da1316e89b08ce
Log: Fixed bug #49175: mod_files.sh does not support hash bits
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 17:01:29 2024 UTC