SET(LIBZYPP_MAJOR "16")
SET(LIBZYPP_COMPATMINOR "0")
SET(LIBZYPP_MINOR "4")
-SET(LIBZYPP_PATCH "2")
+SET(LIBZYPP_PATCH "3")
#
-# LAST RELEASED: 16.4.2 (0)
+# LAST RELEASED: 16.4.3 (0)
# (The number in parenthesis is LIBZYPP_COMPATMINOR)
#=======
-------------------------------------------------------------------
+Mon Feb 20 10:10:43 CET 2017 - ma@suse.de
+
+- PublicKey: Create tmpdirs inside ZYpp::tmpPath (bsc#926844)
+- Don't create AnonymousUniqueId in chroot (bsc#1024741)
+- version 16.4.3 (0)
+
+-------------------------------------------------------------------
Tue Feb 14 12:07:14 CET 2017 - ma@suse.de
- dumpAsXmlOnL: xml escape node content (bsc#1024909)
-
#include <iostream>
+#include <fstream>
#include <list>
#include <string>
z->initializeTarget( tmp.path() );
- BOOST_CHECK( ! z->target()->anonymousUniqueId().empty() );
+ // bsc#1024741: Omit creating a new uid for chrooted systems (if it already has one, fine)
+ BOOST_CHECK( ! PathInfo( tmp.path() / "/var/lib/zypp/AnonymousUniqueId").isExist() );
+ // create an artificial one
+ {
+ Pathname f( tmp.path() / "/var/lib/zypp" );
+ filesystem::assert_dir( f );
+ std::ofstream o( (f/"AnonymousUniqueId").c_str() );
+ o << "AnonymousUniqueId";
+ }
BOOST_CHECK( PathInfo( tmp.path() / "/var/lib/zypp/AnonymousUniqueId").isExist() );
- BOOST_CHECK( PathInfo( tmp.path() / "/var/lib/zypp/AnonymousUniqueId").size() > 0 );
+ BOOST_CHECK_EQUAL( z->target()->anonymousUniqueId(), "AnonymousUniqueId" );
// now check the base product
BOOST_CHECK_EQUAL( z->target()->targetDistribution(), "sle-10-i586");
#include "zypp/base/Exception.h"
#include "zypp/base/LogTools.h"
#include "zypp/Date.h"
-#include "zypp/TmpPath.h"
-
-#include <ctime>
/** \todo Fix duplicate define in PublicKey/KeyRing */
#define GPG_BINARY "/usr/bin/gpg2"
{ return _hiddenKeys; }
protected:
+ std::string _initHomeDir() ///< readFromFile helper to prepare the 'gpg --homedir'
+ { Pathname ret( zypp::myTmpDir() / "PublicKey" ); filesystem::assert_dir( ret ); return ret.asString(); }
+
void readFromFile()
{
PathInfo info( _dataFile.path() );
MIL << "Reading pubkey from " << info.path() << " of size " << info.size() << " and sha1 " << filesystem::checksum(info.path(), "sha1") << endl;
- static filesystem::TmpDir dir;
- std::string tmppath( dir.path().asString() );
+ static std::string tmppath( _initHomeDir() );
std::string datapath( _dataFile.path().asString() );
const char* argv[] =
///////////////////////////////////////////////////////////////////
} // namespace filesystem
+
+ /** Global access to the zypp.TMPDIR (created on demand, deleted when libzypp is unloaded) */
+ Pathname myTmpDir(); // implemented in ZYppImpl.cc
+
} // namespace zypp
#endif // ZYPP_TMPPATH_H
void TransferSettings::addHeader( const std::string &header )
{
+ if ( ! header.empty() )
_impl->_headers.push_back(header);
}
///////////////////////////////////////////////////////////////////
namespace
{
- /** Expand \ref Capability and call \c fnc_r for each namescpace:language
+ /** Expand \ref Capability and call \c fnc_r for each namespace:language
* dependency. Return #invocations of fnc_r, negative if fnc_r returned
* false to indicate abort.
*/
return 0;
}
- /** Expand \ref Capability and call \c fnc_r for each namescpace:language
+ /** Expand \ref Capability and call \c fnc_r for each namespace:language
* dependency. Return #invocations of fnc_r, negative if fnc_r returned
* false to indicate abort.
*/
void TargetImpl::createAnonymousId() const
{
+ // bsc#1024741: Omit creating a new uid for chrooted systems (if it already has one, fine)
+ if ( root() != "/" )
+ return;
- // create the anonymous unique id
- // this value is used for statistics
+ // Create the anonymous unique id, used for download statistics
Pathname idpath( home() / "AnonymousUniqueId");
try
}
return std::string();
}
- } // namescpace
+ } // namespace
///////////////////////////////////////////////////////////////////
Product::constPtr TargetImpl::baseProduct() const
}
///////////////////////////////////////////////////////////////////
+ namespace
+ {
+ std::string guessAnonymousUniqueId( const Pathname & root_r )
+ {
+ // bsc#1024741: Omit creating a new uid for chrooted systems (if it already has one, fine)
+ std::string ret( firstNonEmptyLineIn( root_r / "/var/lib/zypp/AnonymousUniqueId" ) );
+ if ( ret.empty() && root_r != "/" )
+ {
+ // if it has nonoe, use the outer systems one
+ ret = firstNonEmptyLineIn( "/var/lib/zypp/AnonymousUniqueId" );
+ }
+ return ret;
+ }
+ }
std::string TargetImpl::anonymousUniqueId() const
{
- return firstNonEmptyLineIn( home() / "AnonymousUniqueId" );
+ return guessAnonymousUniqueId( root() );
}
// static version:
std::string TargetImpl::anonymousUniqueId( const Pathname & root_r )
{
- return firstNonEmptyLineIn( staticGuessRoot(root_r) / "/var/lib/zypp/AnonymousUniqueId" );
+ return guessAnonymousUniqueId( staticGuessRoot(root_r) );
}
///////////////////////////////////////////////////////////////////
{ _home_path = path; }
Pathname ZYppImpl::tmpPath() const
- {
- static TmpDir zypp_tmp_dir( TmpPath::defaultLocation(), "zypp." );
- return zypp_tmp_dir.path();
- }
+ { return zypp::myTmpDir(); }
/******************************************************************
**
/////////////////////////////////////////////////////////////////
} // namespace zypp_detail
///////////////////////////////////////////////////////////////////
+
+ Pathname myTmpDir() // from TmpPath.h
+ {
+ static filesystem::TmpDir _tmpdir( TmpPath::defaultLocation(), "zypp." );
+ return _tmpdir.path();
+ }
+
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////