bugdavfs2 - Bugs: bug #31537, portability issues with uclibc

 
 

bug #31537: portability issues with uclibc

Submitted by:  Werner Baumann <wbaumann>
Submitted on:  Wed 03 Nov 2010 04:01:45 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: In Progress
Privacy: PublicAssigned to: Werner Baumann <wbaumann>
Open/Closed: Open

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Sat 23 Feb 2013 05:20:41 PM UTC, comment #9:

I enclose a patch that enables building davfs2-1.4.7 under uclibc-0.9.30.3.

It was cross-compiled with gcc-4.3.3 and tested on a ARM NAS running a free alternative firmware (Alt-F) under linux-2.6.35.14 with busybox-1.20.2.

Notes:

-cache.c:check_cache_dir(): if the user home directory has the set-group-ID bit set then the cache is created with the wrong permissions, try to chmod() if first before failing

-webdav.c:ssl_verify(): as rpmatch() doesn't exists, use fgets() and a direct comparison

-umount_dav.c:main(): as canonicalize_file_name() doesn't exists, use realpath()

-mount_dav.h: as "fstab.h" doesn't exists, define _PATH_FSTAB

-mount_dav.c:
o don't include fstab.h, as it doesn't exists
o as argz_create() doesn't exists, include it from gnulib
o check_dir(): some system() command strings are not quoted, making command such as 'cp' fail when the path has spaces on it (such as "/home/Joao Cardoso" -- nothing forbids it)
o check_fstab():
o as getfsfile() doesn't exists, add get_fstab_mountpoint() that uses getmntent()
o disable user/users/mopts check, as busybox mount command does not pass then to the mount helpers; anyway, the mount helpers are only called if user or users are present in the matched fstab entry
o check_mountpoint(): as canonicalize_file_name() doesn't exists, use realpath()

Thanks,
Joao

(file #27511)

Joao Cardoso <jcard>
Thu 12 Jan 2012 08:39:18 PM UTC, comment #8:

malloc warnings:
Missing include <stdlib>; fixed in CVS.

The utime issue is not that urgent. I will care for it later (if I don't forget about it).

In src/Makefile.am I also added a missing -I$(tob_builddir)/gl to AM_CPPFLAGS.

Missing libgnu.a:
That's my error. It is mentioned in the gnulib documentation. (My system has glibc. So I hardly see errors with gnulib. But I will probably use some gnulib extensions like xmalloc etc. in the future that are not in glibc either.)
It did not yet fix this because I want to consult the Automake documentation to see how to best do it (probably in mount_davfs_LDADD like you did).

Cheers
Werner

P.S.: Last time I forgett to mention:
There is also the "seteuid should be replaced with setresuid"-issue I have started to work on (but not finished).

Werner Baumann <wbaumann>
Project AdministratorIn charge of this item.
Thu 12 Jan 2012 05:30:58 PM UTC, comment #7:

Something seems off with gnulib (I'm using a version which is just about a week old).
gnulib creates the static library in ./gl/libgnu.a. This is however not used when doing the final linking; which thus davfs2 fails to compile (see log below).
My patch added _LDADD=libgnu.a, so that works. If I add ../gl/libgnu.a to the below line everything links correctly.
eg in src/Makefile.am

I find it pretty strange since the instructions only talked about adding LIBINTL and LIBICONV, although guides on the internet talk about adding libgnu.a yourself.

I have a few warnings:

linking fails:

Tomi <tomi>
Wed 11 Jan 2012 02:44:13 PM UTC, comment #6:

Ah, yes, sorry. Been away from this kind of development for quite a while. Number one rule is to always work on CVS :)

This also makes things a lot easier. I was having trouble with configure, autoreconfig and such.

Regarding log-writer. That is exactly why I don't only check for '\n' but also for '\0' (in addition to buffer length) as not all debugging lines terminate with a newline.

Under normal circumstances you would not have problems with the writer as a newline would be printed whenever the text has one, however syslog() treats each input as a new entry and uClibc handles things differently from GNU C.

I'll check CVS tonight hopefully, and report back.

Tomi <tomi>
Tue 10 Jan 2012 08:26:22 PM UTC, comment #5:

Hello Tomi,

thanks for the patches. I'm glad there is again somebody who cares about portability issues with uClibc.

But we should avoid double efforts. I have not done a new release of the source package for a long time. But meanwhile I did some bug fixes - including portability issues - and also started using gnulib. But as I made no new release (there was always some 'small' issue I wanted to deal with first, and there still are some) you did not see them. They are only in the CVS-sources. Please always use the CVS-sources for patches.

Some hints how davfs2 sources are organized:
In the CVS sources I try to only store real source files. As far as possible I will not store any files that are created or copied by tools, like the Gnu auto-tools or gnulib.
When you fetch the latest sources from CVS you will need the full set of auto-tools, gettext and now Gnulib too. Please see config/INSTALL.davfs for details. First thing is to run ./bootstrap which will call gnulib-tool, gettext and the auto tools. These tools will copy a lot of files (e.g. .m4 macros) into the source tree and also create the script 'configure'.

The source tarball will contain everthing everthing you need to build the package with './configure; make; make install' without the need to have gnulib, and the auto tools.

Patches that are intended for the main tree of davfs2 should only patch files that are in the source files from CVS. Changes to other files will be overwritten by './bootstrap'.

I think I have already fixed these protability issues in the CVS-sources:
- rpmatch (using gnulib)
- argz (by not using it any more)
- fstab (by using mtab functions like in your patch)
BTW: Sorry. I did not remember having fixed the fstab issue when we discussed your problems with fstab. I think that patch that removes the fstab-checks is no longer necessary when using the CVS-sources.

log-writer:
I could not yet test your patch on my system. But it looks good to me and I think I will apply it. The error is probably not in uClibc but it was my error ta take every call of log_writer for a seperate log entry. So checking for the new line character looks like the proper thing to do. I will have to test it with 'debug httpbody' because I am not sure that these messages will always end with '\n'.

It would be nice if you could test the latest sources from CVS so we can fix the remaining issues with uClib.
To avoid parallel development, her is what I'm working on:
- at the moment (moment = probably next weekend) I am working on bug #33644
- before the next release I also want to fix that 'servercert' mess.

Cheers
Werner

Werner Baumann <wbaumann>
Project AdministratorIn charge of this item.
Mon 09 Jan 2012 12:27:13 PM UTC, comment #4:

I've fixed several issues with uClibc
1. missing rpmatch, argz
2. missing fstab functionality
3. behaviour of fopencookie and no buffering is different from GNU C

1. I've used gnulib to import rpmatch, argz. I've a complete noob on gnulib (and the whole automake stuff in general) so I hope I've done it correctly. All the files generated by gnulib --import (lib/ m4/) should be added to the project I think
2. implement fstab over mntent
3. fix log_writer function. The old behaviour meant that every output's argument was on a new line. I've made a bug report on uClibc to explain the issue https://bugs.busybox.net/show_bug.cgi?id=4670

(file #24770, file #24771, file #24772)

Tomi <tomi>
Sat 12 Feb 2011 05:06:09 PM UTC, comment #3:

Hello Collin.

"On which path can we do discuss about the changes?"
Let's discuss it here.

"Rights management is not mature"
Please explain what problems you see.

"seteuid should replaced with setresuid"
According to the Gnu-Libc-Documentation setreuid is intended for use on systems that lack the _POSIX_SAVED_IDS feature. To enhance portability I will change the code to test for this feature and use setreuid if it is missing.

"cache directory should work with davfs-user / at a directory with davfsuser-file-permissions"
It does.
There are two cases:
- mounting done by root
davfs2 runs as user davfs2. The cache is owned by this user.
- mounting done by an unpriveleged user
davfs2 runs as the mounting user. All resources are treated as private resources owned by this user.
What do you think is wrong with this?

"blocked file systems when files are transferred to server"
Please see https://savannah.nongnu.org/support/?107593

"if I set PREFIX with configure, not all paths in the project or link-creations are right"
Which ones? Please note that there is an exception for /sbin. davfs2 is a mount helper and must be found by mount which only searches /sbin. Please also take notice of the configure script option 'ssbindir'.

Cheers
Werner

Werner Baumann <wbaumann>
Project AdministratorIn charge of this item.
Fri 11 Feb 2011 12:44:26 PM UTC, comment #2:

Initial tests with uclinux / uclibc show that dafvs2 can be work with it.

On which path can we do discuss about the changes?

Problems that I have see:
- Rights management is not mature
- seteuid should replaced with setresuid
- cache directory should work with davfs-user / at a directory with davfsuser-file-permissions
- blocked file systems when files are transferred to server
- if I set PREFIX with configure, not all paths in the project or link-creations are right

Collin Rivers <collin>
Wed 03 Nov 2010 04:17:15 PM UTC, comment #1:

Though I use the GNU autotools to keep davfs2 portable the only system I am familiar with is GNU/Linux. And it is the only system davfs2 has been tested on.
This report is a good chance to start resolving some portability issues. That's what I intend to do:

setfsent, getfsfile and endfsent:
These functions are replaced by setmntent, getmntent and endmntent.

argz_create, argz_stringify, canonicalize_file_name, rpmatch:
I don't want to miss the functionality of these functions. So I am going to use Gnulib to add replacement functions. As I never used Gnulib before this will need some time.

iconvert:
Most systems davfs2 is running on use utf-8 character encoding and iconvert will hardly ever be used. So I should add a configuration option to disable the use of iconvert. Not sure whether to additionally add iconvert from Gnulib.

Werner

Werner Baumann <wbaumann>
Project AdministratorIn charge of this item.
Wed 03 Nov 2010 04:01:45 PM UTC, original submission:

Erik reported this portability issues:

Hey Werner, I'm trying to compile davfs2-1.4.5 on an i686 uclibc system.
I'm using the following package versions:

uclibc-0.9.30.1-r2
gcc-4.4.3-r2

Configuration works properly, but building fails with:
Making all in src
make[2]: Entering directory `/root/davfs2-1.4.5/src'
i686-pc-linux-uclibc-gcc -Wall -g -O2 -I/usr/include/neon
-D_LARGEFILE64_SOURCE -DNE_LFS -o mount.davfs cache.o dav_coda.o dav_fuse.o
kernel_interface.o mount_davfs.o webdav.o -Wl,-O1 -lneon -lz -lssl -lcrypto
-ldl -lz -lxml2 -lz -lm
mount_davfs.o: In function `check_fstab':
/root/davfs2-1.4.5/src/mount_davfs.c:683: undefined reference to `setfsent'
/root/davfs2-1.4.5/src/mount_davfs.c:684: undefined reference to `getfsfile'
/root/davfs2-1.4.5/src/mount_davfs.c:734: undefined reference to `endfsent'
mount_davfs.o: In function `log_dbg_cmdline':
/root/davfs2-1.4.5/src/mount_davfs.c:1829: undefined reference to
`argz_create'
/root/davfs2-1.4.5/src/mount_davfs.c:1830: undefined reference to
`argz_stringify'
mount_davfs.o: In function `check_mountpoint':
/root/davfs2-1.4.5/src/mount_davfs.c:757: undefined reference to
`canonicalize_file_name'
webdav.o: In function `convert':
/root/davfs2-1.4.5/src/webdav.c:1256: undefined reference to `libiconv'
/root/davfs2-1.4.5/src/webdav.c:1257: undefined reference to `libiconv'
webdav.o: In function `dav_init_webdav':
/root/davfs2-1.4.5/src/webdav.c:322: undefined reference to `libiconv_open'
/root/davfs2-1.4.5/src/webdav.c:325: undefined reference to `libiconv_open'
/root/davfs2-1.4.5/src/webdav.c:336: undefined reference to `libiconv_open'
/root/davfs2-1.4.5/src/webdav.c:339: undefined reference to `libiconv_open'
webdav.o: In function `ssl_verify':
/root/davfs2-1.4.5/src/webdav.c:1969: undefined reference to `rpmatch'
collect2: ld returned 1 exit status

First off, I was wondering if iconv.h is a REQUIREMENT to build davfs2 or
if it was possible to build it without iconv support. This is help grealty
since most of what I'm reading is saying icov+gcc+uclibc support is lacking at
best.

Secondly, there are some undefined references above to functions in the
fstab.h library. These look like GLIBC calls as well, I will need to do more
research on this before I can find a fix. Any advice/ideas you have on this
would be greatly appreciated.

Thanks again,
-Erik

Werner Baumann <wbaumann>
Project AdministratorIn charge of this item.

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #27511:  davfs2-1.4.7.patch added by jcard (10kB - text/x-patch)
file #24770:  syslog_for_uClibc.patch added by tomi (2kB - application/octet-stream)
file #24771:  rpmatch_argz_from_gnulib.patch added by tomi (3kB - application/octet-stream)
file #24772:  implement_fstab_as_mntent.patch added by tomi (3kB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jcard (Updated the item)
  • -unavailable- added by tomi (Updated the item)
  • -unavailable- added by collin (Posted a comment)
  • -unavailable- added by wbaumann
  • -unavailable- added by wbaumann (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 23 Feb 2013 05:20:41 PM UTCjcardAttached File-=>Added davfs2-1.4.7.patch, #27511
    Mon 09 Jan 2012 12:27:13 PM UTCtomiAttached File-=>Added syslog_for_uClibc.patch, #24770
      Attached File-=>Added rpmatch_argz_from_gnulib.patch, #24771
      Attached File-=>Added implement_fstab_as_mntent.patch, #24772
    Thu 04 Nov 2010 09:12:45 PM UTCwbaumannCarbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup