Bug 65091

Summary: htcacheclean displays only one cache files when few exists in one subdirectory
Product: Apache httpd-2 Reporter: Artem Egorenkov <aegorenkov.91>
Component: supportAssignee: Apache HTTPD Bugs Mailing List <bugs>
Status: RESOLVED FIXED    
Severity: normal CC: aegorenkov.91
Priority: P2 Keywords: PatchAvailable
Version: 2.4.37   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Attachments: Patch fixing the described problem

Description Artem Egorenkov 2021-01-19 15:42:10 UTC
Sometimes there are few files in one cache subdirectory. In this case using of "htcacheclean -p . -A" will only show one record.

How to reproduce:

1.
# cat /etc/httpd/conf.d/cache.conf 
<IfModule cache_disk_module>
	CacheRoot /var/cache/httpd/proxy
	CacheEnable disk  "/"
	CacheDirLevels 1
</IfModule>

2.
static html with multiple pictures created in /var/www/html/
I just saved ddg image search page with random request

3.
access static html with web browser
cache content should be generated

# ls -l /var/cache/httpd/proxy/9E/
total 112
-rw-------. 1 apache apache 27331 Jan 19 09:53 kMC7qG8oV2vER7QOa5@w.data
-rw-------. 1 apache apache   556 Jan 19 09:53 kMC7qG8oV2vER7QOa5@w.header
-rw-------. 1 apache apache 77684 Jan 19 09:53 sOsGyFnw7UEH29Jyip0Q.data
-rw-------. 1 apache apache   557 Jan 19 09:53 sOsGyFnw7UEH29Jyip0Q.header

4.
# cd /var/cache/httpd/proxy/9E/

Actual result:
# htcacheclean -p . -A
http://192.168.122.75:80/small_image_files/a_020.jpg? 556 27331 200 0 1611046420286395 1611054168715034 1611046420286096 1611046420286395 1 0

Expected result:
# htcacheclean -p . -A
http://192.168.122.75:80/small_image_files/a_020.jpg? 556 27331 200 0 1611046420286395 1611054168715034 1611046420286096 1611046420286395 1 0
http://192.168.122.75:80/small_image_files/a_052.jpg? 557 77684 200 0 1611046420291158 1611054168720273 1611046420290791 1611046420291158 1 0
Comment 1 Artem Egorenkov 2021-01-19 15:45:52 UTC
Created attachment 37705 [details]
Patch fixing the described problem

TEST:

# htcacheclean -p . -A
http://192.168.122.75:80/small_image_files/a_020.jpg? 556 27331 200 0 1611046420286395 1611054168715034 1611046420286096 1611046420286395 1 0
http://192.168.122.75:80/small_image_files/a_052.jpg? 557 77684 200 0 1611046420291158 1611054168720273 1611046420290791 1611046420291158 1 0

# echo $?
0
Comment 2 Joe Orton 2024-02-01 08:40:08 UTC
Merged in r1915508 - belatedly, thank you Artem!