[ubuntu-za] Adding *
Wesley Werner
wesley.werner at gmail.com
Sat Dec 21 14:21:47 UTC 2019
Charl
I suspect you are hitting the argument size limit.
This is not a number-of-files limit, but rather a data limit. Bash expands
not only the filename, but the "full path + filename" for each file, which
totals over the maximum limit. I think the standard limit is 128kB as
defined by the MAX_ARG_PAGES constant when that kernel was compiled.
To work around this you can craft a find instruction, which will be much
slower because it evaluates each file separately, but will get the job done.
find /var/lib/php/sessions -type f -exec rm {} \;
--
Regards
Wesley Werner
On Fri, Dec 20, 2019 at 12:03 PM Charl Wentzel <charl.wentzel at vodamail.co.za>
wrote:
> 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
> --
> ubuntu-za mailing list
> ubuntu-za at lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-za
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-za/attachments/20191221/3bd70894/attachment.html>
More information about the ubuntu-za
mailing list