View Issue Details

IDProjectCategoryView StatusLast Update
0001260SOGoBackend Generalpublic2011-06-23 14:12
Reporterbuzzdee Assigned Toludovic  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version1.3.6 
Target Version1.3.8Fixed in Version1.3.8 
Summary0001260: remove useless header include in NSString+Utilities.m
Description

this #include <crypt.h> breaks compilation of sogo on OpenBSD with llvm/clang.
the header doesn't exist there, and this is an error with llvm/clang, where it is only a warning with gcc. Even the manual page on Linux crypt(3) says that only this is needed:
#define _XOPEN_SOURCE
#include <unistd.h>

which apparently also exists in the NSString+Utilities.m.

attached patch removes this inclusion.

TagsNo tags attached.

Activities

2011-04-13 06:47

 

patch-SoObjects_SOGo_NSString+Utilities_m (326 bytes)   
$OpenBSD$
--- SoObjects/SOGo/NSString+Utilities.m.orig	Fri Apr  8 19:44:28 2011
+++ SoObjects/SOGo/NSString+Utilities.m	Wed Apr 13 08:41:26 2011
@@ -21,8 +21,6 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#include <crypt.h>
-
 #import <Foundation/NSArray.h>
 #import <Foundation/NSCharacterSet.h>
 #import <Foundation/NSData.h>
ludovic

ludovic

2011-06-16 15:32

administrator   ~0002589

Not sure I understand here. How to remove the warning with gcc if we don't include crypt.h?

buzzdee

buzzdee

2011-06-17 09:07

reporter   ~0002599

NSString+Utilities.m has everything needed for crypt(3).
http://linux.die.net/man/3/crypt
It doesn't need to include <crypt.h> at all. Since it exists on Linux, there is no warning, and also no harm in including it anyways. However, when using clang to compile SOPE, this ends in an error, because crypt.h doesn't exist. With gcc, this is only a warning about the nonexistent header file.

Simply removing the include statement, will get rid of the warning with gcc, and will allow compile that file with clang.

I hope now its more clear.

ludovic

ludovic

2011-06-20 20:02

administrator   ~0002608

With the #include <crypt.h>, I get no warning using gcc. But without it, I get:

sogo:~/src/SOGo/SoObjects/SOGo# make
This is gnustep-make 2.2.0. Type 'make print-gnustep-make-help' for help.
Making build-headers for framework SOGo...
Making all for framework SOGo...
Compiling file SOGoBuild.m ...
Compiling file NSString+Utilities.m ...
NSString+Utilities.m:408:2: warning: #warning "encoding" parameter is not useful
NSString+Utilities.m:516:2: warning: #warning this method is a quick and dirty way of detecting the file-format
NSString+Utilities.m: In function ‘-[NSString(SOGoURLExtension) asCryptStringUsingSalt:]’:
NSString+Utilities.m:554: warning: implicit declaration of function ‘crypt’
NSString+Utilities.m:554: warning: assignment makes pointer from integer without a cast
Creating derived_src/NSFramework_SOGo.m...
Compiling file derived_src/NSFramework_SOGo.m ...
Linking framework SOGo ...
Copying resources into the framework wrapper...
Creating SOGo.framework/Versions/1/Resources/Info-gnustep.plist...
sogo:~/src/SOGo/SoObjects/SOGo#

So I don't understand why you say "Simply removing the include statement, will get rid of the warning with gcc..." since removing the include does generate a warning!

ludovic

ludovic

2011-06-23 13:06

administrator   ~0002626

Any updates on this?

buzzdee

buzzdee

2011-06-23 13:30

reporter   ~0002628

Sorry, I haven't seen the comment from the 20.06.

The Linux manual page seems about crypt(3) seems to be wrong, so I'm sorry.
I rechecked the manual page, and the source file, the manual page states, the following is needed:

#define _XOPEN_SOURCE 1
#include <unistd.h>

which is there in the source file, and is enough to compile on OpenBSD.
Maybe then just enclosing the inclusion of the crypt.h so it looks like the following would be enough for me:

#ifndef OpenBSD
#include <crypt.h>
#endif

ludovic

ludovic

2011-06-23 14:12

administrator   ~0002629

Fixed: http://mtn.inverse.ca/revision/diff/a7450cb20f9b7540324748f847e35d9eb3e1ba15/with/b02226d59c16236b8e8eab6e22a7346f679f2ee7

Issue History

Date Modified Username Field Change
2011-04-13 06:47 buzzdee New Issue
2011-04-13 06:47 buzzdee File Added: patch-SoObjects_SOGo_NSString+Utilities_m
2011-06-15 21:03 ludovic Target Version => 1.3.8
2011-06-15 21:03 ludovic Status new => assigned
2011-06-15 21:03 ludovic Assigned To => ludovic
2011-06-16 15:32 ludovic Note Added: 0002589
2011-06-17 09:07 buzzdee Note Added: 0002599
2011-06-20 20:02 ludovic Note Added: 0002608
2011-06-23 13:06 ludovic Note Added: 0002626
2011-06-23 13:30 buzzdee Note Added: 0002628
2011-06-23 14:12 ludovic Note Added: 0002629
2011-06-23 14:12 ludovic Status assigned => resolved
2011-06-23 14:12 ludovic Fixed in Version => 1.3.8
2011-06-23 14:12 ludovic Resolution open => fixed