Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not crash when the repository URL is not defined (bsc#1043218) #77

Merged
merged 1 commit into from
Jun 21, 2017

Conversation

lslezak
Copy link
Member

@lslezak lslezak commented Jun 21, 2017

  • A repository actually might not define the URL, normally this is not the case, but users can manually tweak the .repo file. In that case YaST still should not crash.
  • See this bugzilla comment for more details.

Note

RepoInfo::url() is a shortcut for baseUrlsEmpty() ? Url() : *baseUrlsBegin()), i.e. returns empty URL if the repo does not define it. This can simplify the code a bit, see the details here.

@@ -267,8 +267,14 @@ PkgFunctions::SourceLoadImpl(PkgProgress &progress)
// do not autorefresh remote repositories when the network is not running
if (!network_is_running)
{
zypp::Url url = *((*it)->repoInfo().baseUrlsBegin());

if ((*it)->repoInfo().baseUrlsEmpty())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing spaces ? :-)

zypp::Url url = *((*it)->repoInfo().baseUrlsBegin());

if ((*it)->repoInfo().baseUrlsEmpty())
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

@@ -286,11 +292,17 @@ PkgFunctions::SourceLoadImpl(PkgProgress &progress)
refresh_started_called = true;
}

zypp::RepoManager::RefreshCheckStatus ref_stat = repomanager->checkIfToRefreshMetadata((*it)->repoInfo(), *((*it)->repoInfo().baseUrlsBegin()));
if ((*it)->repoInfo().baseUrlsEmpty())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spaces :-)


refresh = false;
}
if (repoinfo.baseUrlsEmpty())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation

(*_repo.baseUrlsBegin()).asString().c_str());
_maccess = new zypp::MediaSetAccess(_repo.name(), *_repo.baseUrlsBegin()); // FIXME handle multiple baseUrls
_repo.url().asString().c_str());
_maccess = new zypp::MediaSetAccess(_repo.name(), _repo.url()); // FIXME handle multiple baseUrls
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the fixme still needed ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Um, I do not know so I keep it for now 😉

@lslezak
Copy link
Member Author

lslezak commented Jun 21, 2017

The indentation issues are caused by mixed spaces and tabs. GitHub does not display it correctly 😟 . In editor it looks OK. And I'd like to avoid complete reformatting the code.

Copy link
Member

@schubi2 schubi2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's fine. LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants