Feh / nocache

minimize caching effects
BSD 2-Clause "Simplified" License
554 stars 53 forks source link

FTBFS on kfreebsd #12

Closed onlyjob closed 11 years ago

onlyjob commented 11 years ago
cachedel.c:49:36: error: 'POSIX_FADV_DONTNEED' undeclared (first use in this function)
cachedel.c:49:36: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [cachedel] Error 1
Feh commented 11 years ago

Hmm. I don’t have access to a system running kfreebsd. But POSIX_FADV_DONTNEED should be defined in /usr/include/fcntl.h or one of the files it includes…

Feh commented 11 years ago

See the source of kfreebsd-9_9.0-11/sys/sys/fcntl.h:

/*
 * XXX missing posix_fadvise() and POSIX_FADV_* macros.
 */

What is to be done?

noushi commented 11 years ago

Hi there,

It should be mentioned: . kfreebsd isn't up to date regarding the /sys/fcntl.h -> kfreebsd folks should update their file. . freebsd is up to date as shown here: http://fxr.watson.org/fxr/source/sys/fcntl.h

The question is: does (k)FreeBSD support posix_fadvise() correctly? does it behave like Linux's implementation?

As I recall, the nocache implementation includes a workaround for some unavailable features in the Linux kernel?

cheers, Reda

Feh commented 11 years ago

As I recall, the nocache implementation includes a workaround for some unavailable features in the Linux kernel?

Not really. I just had to split the posix_fadvise stuff off to another file, because:

/* Since open() and close() are re-defined in nocache.c, it's not
 * possible to include <fcntl.h> there. So we do it here. */
noushi commented 11 years ago

ha, good to know.

This should fix things inside cachedel.c : https://github.com/noushi/nocache/commit/4a81dca4744bca1f91fe932c41659e236de3ca01

#if __POSIX_VISIBLE < 200112
#define POSIX_FADV_NORMAL       0       /* no special treatment */
#define POSIX_FADV_RANDOM       1       /* expect random page references */
#define POSIX_FADV_SEQUENTIAL   2       /* expect sequential page references */
#define POSIX_FADV_WILLNEED     3       /* will need these pages */
#define POSIX_FADV_DONTNEED     4       /* dont need these pages */
#define POSIX_FADV_NOREUSE      5       /* access data only once */
#endif
noushi commented 11 years ago

Dmitry (@onlyjob), could you retry the builds now?

onlyjob commented 11 years ago

Yes, just tried it, but now it fails in "fcntl_helpers.c":

fcntl_helpers.c: In function ‘fadv_dontneed’: 
fcntl_helpers.c:12:50: error: ‘POSIX_FADV_DONTNEED’ undeclared (first use in this function) 
fcntl_helpers.c:12:50: note: each undeclared identifier is reported only once for each function it appears in 
fcntl_helpers.c: In function ‘fadv_noreuse’: 
fcntl_helpers.c:18:47: error: ‘POSIX_FADV_NOREUSE’ undeclared (first use in this function) 
fcntl_helpers.c:19:1: warning: control reaches end of non-void function [-Wreturn-type] 
Feh commented 11 years ago

@onlyjob, I included @noushi’s macros in fcntl_helpers.c, too with commit 543351b. However I feel we will see another warning about missing function prototypes. Can you try again, please? Are there kfreebsd live systems available to test this?

onlyjob commented 11 years ago

I tested branch "fcntl-posix-fadv" and it built successfully on kfreebsd. However then it hanged on test just after cd t; prove -v ..

I could eventually expose my own kfreebsd-i386 VM for you but to do this I need time to put all the necessary configuration in place. Unfortunately time is something that I have in very short supply. :)

Feh commented 11 years ago

Never mind. I’ll just install it inside a VM myself. It could take a day, though.

noushi commented 11 years ago

dumb question: does kfreebsd actually honor posix_fadvise() ?! what about the regular freebsd?

Feh commented 11 years ago

Regular FreeBSD surely supports this. I will install kfreebsd later and test it out.

For reference, the error messages and the build status are always available on the debian buildd page.

Feh commented 11 years ago

So I installed kfreebsd, but already when compiling, I get a warning:

/tmp/cc9oFzFC.o: In function `main':
cachedel.c:(.text+0x1b8): warning: warning: posix_fadvise is not implemented and will always fail

@onlyjob, can you just make it so that the package is not supported in kfreebsd? Because I wouldn’t know how to solve the case of a missing posix_fadvise function…

onlyjob commented 11 years ago

Thank you for going so far in pursue of this problem.

As long as "nocache" FTBFS on kfreebsd there will be no package available for that platform. I think the best would be to leave as is so at least we will know if/when kfreebsd implement "posix_fadvise"...

We can ignore kfreebsd for package build but I think I like the above option a bit more. What would you prefer?

Feh commented 11 years ago

I‘m not a Debian developer. I just thought that a FTBFS might hinder the package entering the distribution. If that’s not the case I agree we should probably leave it, clearly marked “broken“.

Feh commented 11 years ago

@noushi, thanks for researching the __POSIX_VISIBLE thing – but like indicated I think I will discard this commit, if that’s okay with you.

noushi commented 11 years ago

Hi Julius, Dmitry,

of course, it was mostly a test, so kfreebsd just can't be supported, because it isn't POSIX compliant. @Feh you should mention this in the README.md .

Ultimately, the package is not broken, and kfreebsd isn't supported.

@onlyjob: you can specify which architectures noncache is to be built for in debian/control, right?

cheers, and thank you both, Reda

onlyjob commented 11 years ago

Naturally due to FTBFS package won't be available on broken architecture(s). But build servers will try to build it on every upload and will notify me by email. If it suddenly got fixed I will know. Or if I get annoyed enough with FTBFS emails I can "blacklist" kfreebsd-any to prevent building attempt. I'm not sure what's the best practice in such cases but I reckon it is OK to let it FTBFS.

Thank you very much for checking this issue and sorry for reporting it... Indeed it's should be kfreebsd problem, not yours. I also think it is worth mentioning in README.

Feh commented 11 years ago

Thank you very much for checking this issue and sorry for reporting it... Indeed it's should be kfreebsd problem, not yours.

Not a problem. It is an easy fallacy to believe that only because it works on Linux, it’ll work on any POSIX-compliant UNIX system. So I think it’s better to double-check that what you implemented works correctly than prematurely pointing the finger at others.

noushi commented 11 years ago

kfreebsd is not POSIX compliant! :-)