dolphin in focal can't delete webdav directories running on focal's apache

Bug #1927742 reported by Adam Vodopjan
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apache2 (Ubuntu)
In Progress
Low
Bryce Harrington
Focal
In Progress
Undecided
Bryce Harrington
Jammy
In Progress
Undecided
Bryce Harrington
Lunar
In Progress
Undecided
Bryce Harrington

Bug Description

/etc/apache2/mods-available/setenvif.conf from the apache2 package has this:

    BrowserMatch " Konqueror/4" redirect-carefully

While dolphin is Konqueror/5 in focal. Trying to delete a directory on webdav dolphin just gets a http 301 redirect.

1) The release of Ubuntu you are using, via 'lsb_release -rd' or System -> About Ubuntu
Description: Ubuntu 20.04.2 LTS
Release: 20.04

2) The version of the package you are using, via 'apt-cache policy pkgname' or by checking in Software Center
apache2:
  Installed: 2.4.41-4ubuntu3.1

3) What you expected to happen
Dolphin should be able to remove directories over webdav

4) What happened instead
Apache issues a redirect from prefix/dir to prefix/dir/

    127.0.0.1 - user1 [07/May/2021:02:19:53 +0000] "DELETE /webdav/test HTTP/1.1" 301 578 "-" "Mozilla/5.0 (X11; Linux x86_64) KHTML/5.68.0 (like Gecko) Konqueror/5 KIO/5.68"

Dolphin doesn't follow the redirect hence nothing happens.

Related branches

Revision history for this message
Paride Legovini (paride) wrote :

Hello Ross and thanks for this bug report. Did you actually verify that adding a

  BrowserMatch " Konqueror/5" redirect-carefully

line to setenvif.conf resolves the issue?

Anyway the file belongs to the packaging and not to the upstream source, so the fix belongs to Ubuntu. Waiting for your feedback on the " Konqueror/5" test I'm marking this bug report as Incomplete. Please change its status back to New after commenting back and we'll look at it again. Thanks!

Changed in apache2 (Ubuntu):
status: New → Incomplete
importance: Undecided → Low
Revision history for this message
Adam Vodopjan (grozzly) wrote :

Yes,

BrowserMatch " Konqueror/5" redirect-carefully

does fix the bug.

Changed in apache2 (Ubuntu):
status: Incomplete → New
Changed in apache2 (Ubuntu):
status: New → Triaged
Changed in apache2 (Ubuntu):
assignee: nobody → Michał Małoszewski (michal-maloszewski99)
status: Triaged → In Progress
Revision history for this message
Adam Vodopjan (grozzly) wrote :

While you're at it: kinda the same happens in jammy (as of 22.04.2). This time the user agent for dolphin is:

    Mozilla/5.0 (X11; Linux x86_64) KIO/5.92 dolphin/21.12.3

With stock apache conf when trying to delete a dir over webdav, it results in a 301 redirect: '"DELETE /webdav/test HTTP/1.1" 301 578' => /webdav/test/

With such custom line in setenvif.conf it works as supposed:

    BrowserMatch " dolphin/" redirect-carefully

Revision history for this message
Michał Małoszewski (michal-maloszewski99) wrote :

Thanks for update :)

Revision history for this message
Michał Małoszewski (michal-maloszewski99) wrote :

@Adam

Given the file belongs to the packaging and not to the upstream source, we should expect the Delta to be a long-term one.
That, combined with the fact that this bug is present in Debian too, and Ubuntu currently doesn't make any changes over the Debian package --> this bug would be best fixed directly in Debian, and then Ubuntu will pick up the fix automatically.

So the best way is to file a Debian bug report.

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Michal,

This bug seems to affect Focal/Jammy, and therefore the fix needs to be done in Ubuntu. You also need to check if the issue is still present in Mantic, or if it has already been fixed there.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :
Download full text (3.2 KiB)

Hey you two,
thanks for picking this one up after such a long time.

@Michal - while you are right that the particular config file does not have any changes, the reasoning for "Ubuntu currently doesn't make any changes over the Debian" is usually for auto-sync and apache clearly has changes in general (just not in that file). Therefore that is not a problem.

@Sergio - agreed, for an SRU this needs a test case anyway, which means Michal can start in Mantic and testing it through all releases.

@All
While looking at it quickly I found that there are two files with such a config

From upstream we have this for DAV related usage in
apache2-doc: /usr/share/doc/apache2/examples/apache2/extra/httpd-dav.conf

$ cat docs/conf/extra/httpd-dav.conf.in
...
BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
BrowserMatch "MS FrontPage" redirect-carefully
BrowserMatch "^WebDrive" redirect-carefully
BrowserMatch "^WebDAVFS/1.[01234]" redirect-carefully
BrowserMatch "^gnome-vfs/1.0" redirect-carefully
BrowserMatch "^XML Spy" redirect-carefully
BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully
BrowserMatch " Konqueror/4" redirect-carefully

Then the file we got asked here is in
apache2: /etc/apache2/mods-available/setenvif.conf

$ cat /etc/apache2/mods-available/setenvif.conf
BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
BrowserMatch "MS FrontPage" redirect-carefully
BrowserMatch "^WebDrive" redirect-carefully
BrowserMatch "^WebDAVFS/1\.[012]" redirect-carefully
BrowserMatch "^gnome-vfs/1\.0" redirect-carefully
BrowserMatch "^gvfs/1" redirect-carefully
BrowserMatch "^XML Spy" redirect-carefully
BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully
BrowserMatch " Konqueror/4" redirect-carefull

This is already diverging.
The latter is Ubuntu/Debian delta over upstream.

Now those two are out of sync a lot IMHO
1. [1] fixed escaping, but not upstream?
2. gvfs [2] was added in Debian but never upstream AFAICS
3. Konquerer/4 was added upstream [3] and in Debian [4]

Now here in the bug we have the report of
a) Konqueror/5
b) dolphin/
which both are missing.

I conclude from the findings that:

I. All Debian changes [1][2] not yet there should also get upstream [in docs/conf/extra/httpd-dav.conf.in] (that way we also ensure to get their opinion in about the change in general)

II. The suggestions here seem right, that should go upstream to the same file as well

III. Once discussed accepted there we can be sure this does not back-fire, bring it up with Debian [for docs/conf/extra/httpd-dav.conf.in but there also debian/config-dir/mods-available/setenvif.conf]

IV. At the same time you can start to bring it into mantic [for docs/conf/extra/httpd-dav.conf.in but there also debian/config-dir/mods-available/setenvif.conf] and from there SRU

[1]: https://salsa.debian.org/apache-team/apache2/-/commit/6645d3763038a344f7baa6cb7206d52e7a3b1f5f
[2]: https://salsa.debian.org/apache-team/apache2/-/commit/0d38509c2338f0006130d8d41c334c44d5a98b25
[3]: https://github.com/apache/httpd/commit/c4471432a3925208238473189b4b6f981946a722
[4]: https://salsa.debian.org/apache-team/apache2/-/commit/bf...

Read more...

tags: added: server-todo
tags: removed: server-todo
tags: added: server-todo
Revision history for this message
Michał Małoszewski (michal-maloszewski99) wrote (last edit ):

Hi @Adam,

I tried to figure out how to create a Test Plan for it. And I think I did, but at the end, I had a problem adding a network folder in the Dolphin GUI.

What I did:

1. I started with focal VM, and I created it.
2. I've installed apache2 and the required modules as follows:
- a2enmod dav dav_fs
3. I've created a conf file under
/etc/apache2/sites-available/

and I have added it inside:

<VirtualHost *:80>
    ServerName localhost
    DocumentRoot /var/www/webdav

    Alias /webdav /var/www/webdav
    <Directory /var/www/webdav>
        DAV On
        AllowOverride None
        Require all granted
    </Directory>
</VirtualHost>

4. Then I enabled the new configuration and restarted apache2.

I have created a WebDAV directory and changed ownership:

sudo mkdir -p /var/www/webdav
sudo chown www-data:www-data /var/www/webdav

5. And then I installed Dolphin and wanted to access WebDAV with it, but I was denied access by Dolphin.

I think it might be another bug found along the way, or it might be a problem I only encountered.

Could you please help me a bit and maybe provide me with your steps to reproduce the issue?
I would be really grateful :)

Revision history for this message
Adam Vodopjan (grozzly) wrote :

I've just replicated your steps with a vm booted into ubuntu-20.04.6-desktop-amd64.iso and there are no problems with webdav for me aside for the bug reported:

(I ssh into the vm so when I say "copy-paste" it is literally that)

### install the stuff
- enable the universe repo in /etc/apt/sources.list
- sudo apt update
- sudo apt install apache2 dolphin
### configure apache
- sudo a2enmod dav dav_fs
- copy-paste your apache vhost config into /etc/apache2/sites-available/test.conf
- sudo a2ensite test.conf
- sudo systemctl restart apache2
### webdav dir
- sudo mkdir -p /var/www/webdav
- sudo chown www-data: /var/www/webdav

Now in dolphin, press C-l and enter path "webdav://localhost". There I can create files and dirs, delete files, but not delete dirs.

--

Try enabling the logs. Put these lines (as per /etc/apache2/sites-enabled/000-default.conf) into your test.conf:

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

and restart apache. And keep looking under /var/log/apache2/

Revision history for this message
Michał Małoszewski (michal-maloszewski99) wrote :

Thanks Adam!

I will redo my steps again tomorrow, and I hope it will work or at least the logs will be helpful.

FYI, if I still struggle with that test plan, can I ask you to test the PPA for me?
I would simply provide you with the fix in the PPA (link), and you would simply have to try to reproduce the issue.

Revision history for this message
Adam Vodopjan (grozzly) wrote :

I'll try to help with testing

Revision history for this message
Michał Małoszewski (michal-maloszewski99) wrote :

Hi Adam,

Finally, I was able to get rid of my "dolphin problem", but honestly, I went through Mantic, Lunar, Jammy and Focal and on none of them could I reproduce the issue.
I could create files and directories, delete files, _and_ delete directories.
I tried to determine if that applies exclusively to empty directories or directories with content inside, but I couldn't reproduce the issue either way.

Moreover out of curiosity, I did the same steps on the workstation I am working on daily (not only VMs), where the focal Ubuntu server is installed and the user is different than root, and I also couldn't reproduce that issue.

Revision history for this message
Michał Małoszewski (michal-maloszewski99) wrote :

Hmmm, I am wondering what might be the reason for that. Having in mind that I followed "your&mine" steps to reproduce it.

Revision history for this message
Adam Vodopjan (grozzly) wrote :

> I could create files and directories, delete files, _and_ delete directories.

When you say "delete dirs" have you actually checked if it was removed on disk? In dolphin it disappers from the view, but press F5 to refresh and it's still there.

Revision history for this message
Adam Vodopjan (grozzly) wrote (last edit ):

You can see the problem even without actual dolphin, curl is enough. In focal with apache set up as above:

$> cd /var/www/webdav
$> mkdir a
$> chown www-data: a
$> curl -I -X DELETE http://localhost/a
HTTP/1.1 301 Moved Permanently
Date: Wed, 09 Aug 2023 16:05:00 GMT
Server: Apache/2.4.41 (Ubuntu)
Location: http://localhost/a/
Content-Length: 302
Content-Type: text/html; charset=iso-8859-1
$> curl -I -X DELETE -A 'prefix Konqueror/5' http://localhost/a
HTTP/1.1 301 Moved Permanently
Date: Wed, 09 Aug 2023 16:06:04 GMT
Server: Apache/2.4.41 (Ubuntu)
Location: http://localhost/a/
Content-Length: 302
Content-Type: text/html; charset=iso-8859-1
$> curl -I -X DELETE -A 'prefix Konqueror/4' http://localhost/a
HTTP/1.1 204 No Content
Date: Wed, 09 Aug 2023 16:09:28 GMT
Server: Apache/2.4.41 (Ubuntu)

See? It rejects (with redirect) curl's own user agent as well as Konqueror/5, which is dolphin in focal. But Konqueror/4 is OK since it is mentioned in `BrowserMatch " Konqueror/4" redirect-carefully` in /etc/apache2/mods-available/setenvif.conf

Revision history for this message
Michał Małoszewski (michal-maloszewski99) wrote :

Sure, that's true. First I wanted to reproduce it in the simplest way as the bug did not mention explicitly how the directory behaves after deletion, but after I wrote comment #13, I realised that it was not removed from the disk by doing: ls -li /path. Later, I saw your comment, and then I was sure it was a good way of thinking.

I tested it through releases, and Mantic, Lunar, Jammy and Focal are affected by that issue.

My next steps are:
1. Prepare patches for upstream as per comment#7 and test patches using the test case that I created. Then submit and discuss upstream.
2. Then I will take care of Debian and Ubuntu.

P.S. Btw, thank you Adam for being a really helpful and responsive bug reporter. I appreciate it.

Changed in apache2 (Ubuntu Focal):
status: New → In Progress
Changed in apache2 (Ubuntu Jammy):
status: New → In Progress
Changed in apache2 (Ubuntu Lunar):
status: New → In Progress
Changed in apache2 (Ubuntu Focal):
assignee: nobody → Michał Małoszewski (michal-maloszewski99)
Changed in apache2 (Ubuntu Jammy):
assignee: nobody → Michał Małoszewski (michal-maloszewski99)
Changed in apache2 (Ubuntu Lunar):
assignee: nobody → Michał Małoszewski (michal-maloszewski99)
Revision history for this message
Michał Małoszewski (michal-maloszewski99) wrote :

Waiting for the answer from upstream: https://bz.apache.org/bugzilla/show_bug.cgi?id=67039

Revision history for this message
Michał Małoszewski (michal-maloszewski99) wrote :

No answer from upstream. MP ready, will be uploaded early in 24.04

Bryce Harrington (bryce)
Changed in apache2 (Ubuntu):
assignee: Michał Małoszewski (michal-maloszewski99) → Bryce Harrington (bryce)
Changed in apache2 (Ubuntu Focal):
assignee: Michał Małoszewski (michal-maloszewski99) → Bryce Harrington (bryce)
Changed in apache2 (Ubuntu Jammy):
assignee: Michał Małoszewski (michal-maloszewski99) → Bryce Harrington (bryce)
Changed in apache2 (Ubuntu Lunar):
assignee: Michał Małoszewski (michal-maloszewski99) → Bryce Harrington (bryce)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.