Bug#985903: lib3MF.so.1: undefined symbol: zip_fclose

2021-04-03 Thread Kristian Nielsen
Not 100% clear what the issue(s) reported here are, but I looked through the
patches, and saw these:

1. Some libz/libzip changes. I'm guessing these are to avoid having to add
-lz/-lzip to the using project? There was a related change in the recent
NMU, 1.8.1+ds-3.1, which instead adds links to these libraries. This might
fix the problem reported here also.

2. There are some code-style changes (and a -Wall which may have triggered
these), these may be reasonable but perhaps not too relevant for the Debian
packaging.

3. There is what looks like a fix of a genuine mistake in the code
(always-true conditional). I files this upstream here:

  https://github.com/3MFConsortium/lib3mf/issues/262

Is there any user impact from this bug, or was it perhaps just something
noticed from -Wall? (At this stage an important impact is needed to include
a fix in the bullseye release).

 - Kristian.



Bug#985903: lib3MF.so.1: undefined symbol: zip_fclose

2021-03-25 Thread John Mullee
Package: lib3mf1
Version: 1.8.1+ds-3
Severity: important
Tags: patch upstream

Dear Maintainer,

   * running CGAL Demos
   * Recompiled lib from sources, after debugging and patching
 NB : wouldn't build as was
   * cgal-demo runs and can r/w *.3mf files
   * had expected cgal demo to work;



-- System Information:
Debian Release: bullseye/sid
  APT prefers focal-security
  APT policy: (650, 'focal-security'), (500, 'focal-updates'), (500, 'focal'), 
(100, 'focal-backports')
Architecture: amd64 (x86_64)

Kernel: Linux 5.8.0-44-lowlatency (SMP w/2 CPU cores; PREEMPT)
Kernel taint flags: TAINT_WARN
Locale: LANG=en_IE.UTF-8, LC_CTYPE=en_IE.UTF-8 (charmap=UTF-8) (ignored: LC_ALL 
set to en_IE.UTF-8), LANGUAGE=en_IE (charmap=UTF-8) (ignored: LC_ALL set to 
en_IE.UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages lib3mf1 depends on:
ii  libc6   2.31-0ubuntu9.2
ii  libgcc-s1   10.2.0-5ubuntu1~20.04
ii  libstdc++6  10.2.0-5ubuntu1~20.04
ii  libuuid12.34-0.1ubuntu9.1

lib3mf1 recommends no packages.

lib3mf1 suggests no packages.

-- no debconf information
--- lib3mf-1.8.1+ds/CMakeLists.txt  2019-01-08 12:36:18.0 +
+++ ./l2/CMakeLists.txt 2021-03-25 16:41:10.790119112 +
@@ -18,14 +18,20 @@
 # use the cmake option -DNMR_COM_NATIVE:BOOL=ON to build the COM interface
 option(NMR_COM_NATIVE "Implement a COM interface" OFF)

+## `uname -s`
+if ("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Linux")
+option(USE_INCLUDED_ZLIB "Use included zlib" OFF)
+option(USE_INCLUDED_LIBZIP "Use included libzip" OFF)
+else()
 option(USE_INCLUDED_ZLIB "Use included zlib" ON)
 option(USE_INCLUDED_LIBZIP "Use included libzip" ON)
+endif()

 if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
   # using GCC
   add_definitions(-DBUILD_DLL)
   add_compile_options(-Wall)
-  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O2")
+  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O2 -Wall")
 elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
   # using GCC
   add_definitions(-DBUILD_DLL)
@@ -114,6 +120,26 @@
endif()
target_link_libraries(${PROJECT_NAME}_s ${LIBUUID_PATH})
endif()
+if (NOT USE_INCLUDED_LIBZIP)
+ ZIP
+find_library(LIBZIP_PATH zip)
+if(NOT LIBZIP_PATH)
+message(FATAL_ERROR "libzip not found")
+endif()
+message("USE_INCLUDED_LIBZIP ... " ${USE_INCLUDED_LIBZIP})
+message("LIBZIP_PATH ... " ${LIBZIP_PATH})
+target_link_libraries(${PROJECT_NAME}_s ${LIBZIP_PATH})
+endif()
+if (NOT USE_INCLUDED_ZLIB)
+ ZLIB
+find_library(ZLIB_PATH zip)
+if(NOT ZLIB_PATH)
+message(FATAL_ERROR "zlib not found")
+endif()
+message("USE_INCLUDED_ZLIB ... " ${USE_INCLUDED_ZLIB})
+message("ZLIB_PATH ... " ${ZLIB_PATH})
+target_link_libraries(${PROJECT_NAME}_s ${ZLIB_PATH})
+endif()
 else()
# wd4996 masks the deprecated-warning
target_compile_options(${PROJECT_NAME}_s PUBLIC 
"$<$:/Od;/Ob0;/Gm;/sdl;/W3;/WX;/FC;/wd4996>")
@@ -148,9 +174,9 @@
 install(FILES ${CMAKE_BINARY_DIR}/lib3MF.pc DESTINATION 
${CMAKE_INSTALL_LIBDIR}/pkgconfig)

 #
-option(LIB3MF_TESTS "Switch whether the tests of Lib3MF should be build" ON)
+option(LIB3MF_TESTS "Switch whether the tests of Lib3MF should be build" OFF)
+### extra dependency package googletests
 if(NOT DEFINED LIB3MF_TESTS)
-   set(LIB3MF_TESTS TRUE)
+   set(LIB3MF_TESTS FALSE)
 endif()
 message("LIB3MF_TESTS ... " ${LIB3MF_TESTS})
 if(LIB3MF_TESTS)

# prevent: warning: catching polymorphic type ‘class std::bad_alloc’ by value 
[-Wcatch-value=]

diff -rU 3 lib3mf-1.8.1+ds/Source/Common/Platform/NMR_ImportStream_Memory.cpp 
l2/Source/Common/Platform/NMR_ImportStream_Memory.cpp
--- lib3mf-1.8.1+ds/Source/Common/Platform/NMR_ImportStream_Memory.cpp  
2019-01-08 12:36:18.0 +
+++ l2/Source/Common/Platform/NMR_ImportStream_Memory.cpp   2021-03-25 
15:59:44.169063834 +
@@ -62,7 +62,7 @@
try {
m_Buffer.resize((size_t)cbCapacity);
}
-   catch (std::bad_alloc) {
+   catch (std::bad_alloc &x) {
throw CNMRException(NMR_ERROR_INVALIDBUFFERSIZE);
}
 

# prevent: warning: this ‘if’ clause does not guard... 
[-Wmisleading-indentation]

diff -rU 3 lib3mf-1.8.1+ds/Source/Model/Reader/NMR_ModelReaderNode.cpp 
l2/Source/Model/Reader/NMR_ModelReaderNode.cpp
--- lib3mf-1.8.1+ds/Source/Model/Reader/NMR_ModelReaderNode.cpp 2019-01-08 
12:36:18.0 +
+++ l2/Source/Model/Reader/NMR_ModelReaderNode.cpp  2021-03-25 
15:59:21.067063320 +
@@ -161,21 +161,23 @@
switch (NodeType) {
case XMLREADERNODETYPE_STARTELEMENT:
pXMLReader->GetLocalName(&pszLocalName, 
&nCount);
-