Req #49175 [Com]: mod_files.sh patch

From: Date: Tue, 21 Dec 2010 00:36:36 +0000
Subject: Req #49175 [Com]: mod_files.sh patch
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-157160@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=49175&edit=1

 ID:                 49175
 Comment by:         mastermind dot ua at gmail dot com
 Reported by:        oorza2k5 at gmail dot com
 Summary:            mod_files.sh patch
 Status:             Open
 Type:               Feature/Change Request
 Package:            Session related
 Operating System:   *nix
 PHP Version:        5.3.0
 Block user comment: N
 Private report:     N

 New Comment:

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


Previous Comments:
------------------------------------------------------------------------
[2009-08-06 02:51:23] 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



------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=49175&edit=1


Thread (4 messages)

« previous php.bugs (#157160) next »