[ubuntu-za] Adding *

Charl Wentzel charl.wentzel at vodamail.co.za
Fri Dec 20 10:03:13 UTC 2019


Hi Guys

I'm trying to clean out the PHP sessions in my /var/lib/php/sessions 
folder on an Amazon Ubuntu VM and got a weird issue.

I tried to remove the file the normal way and got this:

    $> sudo rm /var/lib/php/sessions/*
    rm: cannot remove '/var/lib/php/sessions/*': No such file or directory


After some playing around, I found this:

    $> sudo ls -al /var/lib/php/sessions/*
    ls: cannot access '/var/lib/php/sessions/*': No such file or directory


but:

    $> sudo ls -al /var/lib/php/sessions
    total 44208
    drwx-wx-wt 2 root     root     36081664 Dec 20 09:38 .
    drwxr-xr-x 4 root     root         4096 Apr 1  2019 ..
    -rw------- 1 www-data www-data       34 Dec 19 15:43
    ci_session0029m1175gakqtu2ibmhg3kjpj
    -rw------- 1 www-data www-data       34 Dec 19 18:25
    ci_session00sof6339dlkhe4alsq03j6fc6
    -rw------- 1 www-data www-data       34 Dec 19 14:28
    ci_session01mti7bhkieu92or884dq8rl1e
    -rw------- 1 www-data www-data       34 Dec 19 19:35
    ci_session0222hqf704b3gf9glgjms5l2cj
    -rw------- 1 www-data www-data       34 Dec 19 19:15
    ci_session022p1905a122h3rab24b306kuc
    -rw------- 1 www-data www-data       34 Dec 19 16:15
    ci_session03ccgr9c9ilpka4g0b0jlc5c6p
    -rw------- 1 www-data www-data       34 Dec 19 16:21
    ci_session04d66bc2jva5ngmf9vjjn99l79
    ...


Why does adding "*" fail here?  When I do it my own laptop, it works, 
but on the VM it fails.
- I initially thought it was the file permissions and ownership, but 
it's the same in both cases.
- I looked at * expansion (eg. "~/" vs. ~/, where ~ is not expanded in 
double quotes), but found nothing.

The only clue I could found was when I switched to the root user and 
tried it again:

    $ sudo -s
    $ sudo ls -al /var/lib/php/sessions/*
    sudo: unable to execute /bin/ls: Argument list too long


Which could mean it is related to the number of files in the folder, but 
it is hardly that much:

    $sudo ls -al /var/lib/php/sessions | wc
        2242   20171  201633


I would love to know if someone else has a clue.

Regards
Charl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-za/attachments/20191220/3bde8722/attachment.html>


More information about the ubuntu-za mailing list