OPTION (ENABLE_BUILD_DOCS "Build documentation by default?" OFF)
OPTION (ENABLE_BUILD_TRANS "Build translation files by default?" OFF)
OPTION (ENABLE_BUILD_TESTS "Build and run test suite by default?" OFF)
-OPTION (ENABLE_USE_THREADS "Enable using threads (NOT being used by threads!)?" OFF)
OPTION (ENABLE_ZSTD_COMPRESSION "Build with zstd compression support?" OFF)
OPTION (ENABLE_ZCHUNK_COMPRESSION "Build with zchunk compression support?" OFF)
# Helps with bug https://bugzilla.gnome.org/show_bug.cgi?id=784550 , Segfault during signal emission when slots are cleared
CHECK_C_COMPILER_FLAG("-Werror=format-security" CC_FORMAT_SECURITY)
CHECK_CXX_COMPILER_FLAG("-Werror=format-security" CXX_FORMAT_SECURITY)
-SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-strict-aliasing -fPIC -g -Wall -Wp,-D_GLIBCXX_ASSERTIONS" )
-SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing -fPIC -g -Wall -Wp,-D_GLIBCXX_ASSERTIONS" )
+SET( CMAKE_THREAD_PREFER_PTHREAD TRUE )
+FIND_PACKAGE( Threads REQUIRED )
+IF ( NOT CMAKE_USE_PTHREADS_INIT )
+ MESSAGE( FATAL_ERROR "No pthreads found" )
+ENDIF ( NOT CMAKE_USE_PTHREADS_INIT )
+
+SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread -fno-strict-aliasing -fPIC -g -Wall -Wp,-D_GLIBCXX_ASSERTIONS" )
+SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -fno-strict-aliasing -fPIC -g -Wall -Wp,-D_GLIBCXX_ASSERTIONS" )
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden -Woverloaded-virtual -Wnon-virtual-dtor" )
####################################################################
-IF ( ENABLE_USE_THREADS )
- SET( CMAKE_THREAD_PREFER_PTHREAD TRUE )
- FIND_PACKAGE( Threads REQUIRED )
- IF ( CMAKE_USE_PTHREADS_INIT )
- MESSAGE( STATUS "May use threads." )
- SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread -DZYPP_USE_THREADS" )
- SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -DZYPP_USE_THREADS" )
- ENDIF ( CMAKE_USE_PTHREADS_INIT )
-ENDIF ( ENABLE_USE_THREADS )
-
INCLUDE(CheckSymbolExists)
FIND_PACKAGE(Rpm REQUIRED)
IF ( NOT RPM_FOUND)
SET(LIBZYPP_MAJOR "17")
SET(LIBZYPP_COMPATMINOR "22")
SET(LIBZYPP_MINOR "28")
-SET(LIBZYPP_PATCH "1")
+SET(LIBZYPP_PATCH "2")
#
-# LAST RELEASED: 17.28.1 (22)
+# LAST RELEASED: 17.28.2 (22)
# (The number in parenthesis is LIBZYPP_COMPATMINOR)
#=======
%build
mkdir build
cd build
+%if 0%{?suse_version} > 1500
+# Bug 1189788 - UsrMerge: filesystem package breaks system when upgraded in a single rpm transaction
+# While the bug is not fixed, we don't allow ZYPP_SINGLE_RPMTRANS=1 on a not UsrMerged system
+export CFLAGS="%{optflags} -DNO_SINGLETRANS_USERMERGE"
+export CXXFLAGS="%{optflags} -DNO_SINGLETRANS_USERMERGE"
+%else
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags}"
+%endif
unset EXTRA_CMAKE_OPTIONS
cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} \
-------------------------------------------------------------------
+Tue Aug 31 10:49:51 CEST 2021 - ma@suse.de
+
+- Workaround Bug 1189788: Don't allow ZYPP_SINGLE_RPMTRANS=1 on a
+ not UsrMerged Tumbleweed system.
+- version 17.28.2 (22)
+
+-------------------------------------------------------------------
Mon Aug 23 08:39:15 CEST 2021 - ma@suse.de
- Fix crashes in logging code when shutting down (bsc#1189031)
TARGET_LINK_LIBRARIES(${LIBNAME} zypp-core )
TARGET_LINK_LIBRARIES(${LIBNAME} zypp-protobuf )
-
TARGET_LINK_LIBRARIES(${LIBNAME} ${UTIL_LIBRARY} )
TARGET_LINK_LIBRARIES(${LIBNAME} ${RPM_LIBRARY} )
TARGET_LINK_LIBRARIES(${LIBNAME} ${GETTEXT_LIBRARIES} )
TARGET_LINK_LIBRARIES(${LIBNAME} ${GPGME_PTHREAD_LIBRARIES})
target_link_libraries(${LIBNAME} ${YAML_CPP_LIBRARIES})
target_link_libraries(${LIBNAME} ${PROTOBUF_LITE_LIBRARIES})
+ TARGET_LINK_LIBRARIES(${LIBNAME} pthread )
IF (ENABLE_ZSTD_COMPRESSION)
TARGET_LINK_LIBRARIES(${LIBNAME} ${ZSTD_LIBRARY})
#include <zypp-core/base/LogControl.h>
#include <zypp-core/TriBool.h>
+#ifdef NO_SINGLETRANS_USERMERGE
+#include <zypp/PathInfo.h>
+#include <zypp/ZYppCallbacks.h>
+#endif
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
bool singleTransInEnv ()
{
- static TriBool singleTrans = indeterminate;
- if ( indeterminate(singleTrans) ) {
+ static bool singleTrans = ([]()->bool{
const char *val = ::getenv("ZYPP_SINGLE_RPMTRANS");
- if ( val && std::string_view( val ) == "1" )
- singleTrans = true;
- else
- singleTrans = false;
- }
- // for some reason some compilers do not accept the implicit conversion to bool here.
- return bool( singleTrans );
+#ifdef NO_SINGLETRANS_USERMERGE
+ // Bug 1189788 - UsrMerge: filesystem package breaks system when upgraded in a single rpm transaction
+ // While the bug is not fixed, we don't allow ZYPP_SINGLE_RPMTRANS=1 on a not UsrMerged system.
+ // I.e. if /lib is a directory and not a symlink.
+ bool ret = ( val && std::string_view( val ) == "1" );
+ if ( ret && PathInfo( "/lib", PathInfo::LSTAT ).isDir() ) {
+ WAR << "Ignore $ZYPP_SINGLE_RPMTRANS=1: Bug 1189788 - UsrMerge: filesystem package breaks system when upgraded in a single rpm transaction" << std::endl;
+ JobReport::info(
+ "[boo#1189788] Tumbleweeds filesystem package seems to be unable to perform the\n"
+ " UsrMerge reliably in a single transaction. The requested\n"
+ " $ZYPP_SINGLE_RPMTRANS=1 will therefore be IGNORED because\n"
+ " the UsrMerge did not yet happen on this system."
+ , JobReport::UserData( "cmdout", "[boo#1189788]" ) );
+ return false;
+ }
+ return ret;
+#else
+ return ( val && std::string_view( val ) == "1" );
+#endif
+ })();
+ return singleTrans;
}
///////////////////////////////////////////////////////////////////
extern "C"
{
#include <solv/repo_rpmdb.h>
+#include <solv/chksum.h>
}
namespace zypp
{
case NetworkRequestError::NotFound:
ZYPP_THROW( zypp::media::MediaFileNotFoundException( reqUrl, filename ) );
break;
+ case NetworkRequestError::ExceededMaxLen:
+ ZYPP_THROW( zypp::media::MediaFileSizeExceededException( reqUrl, 0 ) );
+ break;
default:
break;
}
#include <zypp/base/Logger.h>
#include <zypp/base/String.h>
+#include <zypp/base/DtorReset.h>
using namespace boost;
void NetworkRequestDispatcherPrivate::handleMultiSocketAction(curl_socket_t nativeSocket, int evBitmask)
{
int running = 0;
- CURLMcode rc = curl_multi_socket_action( _multi, nativeSocket, evBitmask, &running );
+
+ // when inside a curl callback we can not call another multi curl API,
+ // for now just lock the thing, but we should consider rewriting this
+ // to post events instead of doing direct calls simply to decouple from
+ // that limitation
+ CURLMcode rc = CURLM_OK;
+ {
+ zypp::DtorReset lockSet( _locked );
+ _locked = true;
+ rc = curl_multi_socket_action( _multi, nativeSocket, evBitmask, &running );
+ }
if (rc != 0) {
//we can not recover from a error like that, cancel all and stop
NetworkRequestError err = NetworkRequestErrorPrivate::fromCurlMError( rc );
_sigError.emit( *z_func() );
return;
}
+
+ // make sure we dequeue pending requests ( in case a call to dequeue was blocked during the API call )
+ zypp::OnScopeExit scopeFinally([this](){
+ this->dequeuePending();
+ });
int msgs_left = 0;
CURLMsg *msg = nullptr;
void NetworkRequestDispatcherPrivate::cancelAll( NetworkRequestError result )
{
//prevent dequeuePending from filling up the runningDownloads again
+ zypp::DtorReset lockReset( _locked );
_locked = true;
while ( _runningDownloads.size() ) {
std::shared_ptr<NetworkRequest> &req = _pendingDownloads.back();
setFinished(*req, result );
}
-
- _locked = false;
}
void NetworkRequestDispatcherPrivate::setFinished( NetworkRequest &req, NetworkRequestError result )
for( const auto &req : _runningRequests ) {
dlnowMulti += req->downloadedByteCount();
}
+
+ if ( !assertExpectedFilesize( dlnowMulti ) )
+ return;
+
stateMachine()._sigProgress.emit( *stateMachine().z_func(), _fileSize, dlnowMulti );
}
}
_downloadedMultiByteCount += req.downloadedByteCount();
+ if ( !assertExpectedFilesize( _downloadedMultiByteCount ) ) {
+ return;
+ }
MIL_MEDIA << "Request finished "<<std::endl;
const auto &rngs = reqLocked->requestedRanges();
if ( req->_myMirror )
req->_myMirror->startTransfer();
}
+
+ bool RangeDownloaderBaseState::assertExpectedFilesize( off_t currentFilesize )
+ {
+ const off_t expFSize = stateMachine()._spec.expectedFileSize();
+ if ( expFSize > 0 && expFSize < currentFilesize ) {
+ setFailed( NetworkRequestErrorPrivate::customError( NetworkRequestError::ExceededMaxLen ) );
+ return false;
+ }
+ return true;
+ }
/**
* Just initialize the requests ranges from the internal blocklist
void handleRequestError( std::shared_ptr<Request> req, const zyppng::NetworkRequestError &err );
bool addBlockRanges( std::shared_ptr<Request> req, std::vector<Block> &&blocks ) const;
void addNewRequest (std::shared_ptr<Request> req, const bool connectSignals = true );
+ bool assertExpectedFilesize ( off_t currentFilesize );
std::vector<Block> getNextBlocks ( const std::string &urlScheme );
std::vector<Block> getNextFailedBlocks( const std::string &urlScheme );