[SRU] ccls: FTBFS with llvm-10

Bug #1874508 reported by Shengjing Zhu
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ccls (Ubuntu)
Fix Released
Undecided
Unassigned
Focal
Fix Released
Undecided
Unassigned

Bug Description

[Impact]
* the package in the archive currently FTBFS with llvm-default to 10

[Test Case]
* dpkg-buildpackage it

[Regression Potential]
* minimal, the new release is fixing only this problem, and comes from Debian maintainer

[Other info]
I find this package FTBFS in focal, because llvm-defaults is updated to 10.

https://launchpad.net/ubuntu/+source/ccls/0.20190823.5-1build1

The new version in Debian(sid) can fix this.

How does the SRU procedure work? Is this upstream microrelease suite for SRU?

The diff looks quite minimal.

```
diff -Nru ccls-0.20190823.5/debian/changelog ccls-0.20190823.6/debian/changelog
--- ccls-0.20190823.5/debian/changelog 2019-11-13 00:25:32.000000000 +0800
+++ ccls-0.20190823.6/debian/changelog 2020-04-22 15:03:08.000000000 +0800
@@ -1,3 +1,11 @@
+ccls (0.20190823.6-1) unstable; urgency=medium
+
+ * New upstream release 0.20190823.6
+ * Update Standards-Version to 4.5.0 (no changes)
+ * Run ccls index in autopkgtest
+
+ -- Shengjing Zhu <email address hidden> Wed, 22 Apr 2020 15:03:08 +0800
+
 ccls (0.20190823.5-1) unstable; urgency=medium

   * New upstream release 0.20190823.5
diff -Nru ccls-0.20190823.5/debian/control ccls-0.20190823.6/debian/control
--- ccls-0.20190823.5/debian/control 2019-11-13 00:25:32.000000000 +0800
+++ ccls-0.20190823.6/debian/control 2020-04-22 15:03:08.000000000 +0800
@@ -11,7 +11,7 @@
  llvm-dev,
  python3 <!nocheck>,
  rapidjson-dev,
-Standards-Version: 4.4.1
+Standards-Version: 4.5.0
 Homepage: https://github.com/MaskRay/ccls
 Vcs-Browser: https://salsa.debian.org/zhsj/ccls
 Vcs-Git: https://salsa.debian.org/zhsj/ccls.git
diff -Nru ccls-0.20190823.5/debian/tests/lsp-test ccls-0.20190823.6/debian/tests/lsp-test
--- ccls-0.20190823.5/debian/tests/lsp-test 2019-11-13 00:25:32.000000000 +0800
+++ ccls-0.20190823.6/debian/tests/lsp-test 2020-04-22 15:03:08.000000000 +0800
@@ -7,7 +7,7 @@
 import subprocess
 import time

-
+ccls = os.getenv("CCLS", "ccls")
 path = os.path.dirname(os.path.realpath(__file__))

 tests = [
@@ -118,17 +118,17 @@
     return json.loads(f.read(size).decode())

+subprocess.run([ccls, "-index=."], stderr=subprocess.STDOUT).check_returncode()
+
 with subprocess.Popen(
- [os.getenv("CCLS", "ccls"), "-v=-1"], stdin=subprocess.PIPE, stdout=subprocess.PIPE
+ [ccls, "-v=-1"], stdin=subprocess.PIPE, stdout=subprocess.PIPE
 ) as proc:
     for tt in tests:
         method = tt[0]["method"]
         print("Testing", method)
         proc.stdin.write(encode(tt[0]))
         proc.stdin.flush()
- if method == "initialize":
- # wait for ccls to finish indexing
- time.sleep(2)
+ time.sleep(1)
         got = read(proc.stdout)
         if not tt[1] == got:
             print("Expect:")
diff -Nru ccls-0.20190823.5/src/clang_tu.cc ccls-0.20190823.6/src/clang_tu.cc
--- ccls-0.20190823.5/src/clang_tu.cc 2019-11-13 00:22:48.000000000 +0800
+++ ccls-0.20190823.6/src/clang_tu.cc 2020-04-22 15:02:27.000000000 +0800
@@ -8,6 +8,7 @@

 #include <clang/AST/Type.h>
 #include <clang/Lex/Lexer.h>
+#include <llvm/Support/Host.h>
 #include <llvm/Support/Path.h>

 using namespace clang;
diff -Nru ccls-0.20190823.5/src/filesystem.cc ccls-0.20190823.6/src/filesystem.cc
--- ccls-0.20190823.5/src/filesystem.cc 2019-11-13 00:22:48.000000000 +0800
+++ ccls-0.20190823.6/src/filesystem.cc 2020-04-22 15:02:27.000000000 +0800
@@ -31,7 +31,8 @@
       curr.pop_back();
       for (sys::fs::directory_iterator i(folder1, ec, false), e; i != e && !ec;
            i.increment(ec)) {
- std::string path = i->path(), filename = sys::path::filename(path);
+ std::string path = i->path();
+ std::string filename(sys::path::filename(path));
         if ((filename[0] == '.' && filename != ".ccls") ||
             sys::fs::status(path, status, false))
           continue;
diff -Nru ccls-0.20190823.5/src/indexer.cc ccls-0.20190823.6/src/indexer.cc
--- ccls-0.20190823.5/src/indexer.cc 2019-11-13 00:22:48.000000000 +0800
+++ ccls-0.20190823.6/src/indexer.cc 2020-04-22 15:02:27.000000000 +0800
@@ -10,6 +10,7 @@
 #include "sema_manager.hh"

 #include <clang/AST/AST.h>
+#include <clang/Basic/TargetInfo.h>
 #include <clang/Frontend/FrontendAction.h>
 #include <clang/Frontend/MultiplexConsumer.h>
 #include <clang/Index/IndexDataConsumer.h>
@@ -508,7 +509,7 @@
     llvm::raw_svector_ostream os(str);
     d->print(os, getDefaultPolicy());

- std::string name = os.str();
+ std::string name(str.data(), str.size());
     simplifyAnonymous(name);
     // Remove \n in DeclPrinter.cpp "{\n" + if(!TerseOutput)something + "}"
     for (std::string::size_type i = 0;;) {
@@ -677,10 +678,13 @@
 public:
   IndexDataConsumer(IndexParam &param) : param(param) {}
   void initialize(ASTContext &ctx) override { this->ctx = param.ctx = &ctx; }
- bool handleDeclOccurence(const Decl *d, index::SymbolRoleSet roles,
- ArrayRef<index::SymbolRelation> relations,
- SourceLocation src_loc,
- ASTNodeInfo ast_node) override {
+#if LLVM_VERSION_MAJOR < 10 // llvmorg-10-init-12036-g3b9715cb219
+# define handleDeclOccurrence handleDeclOccurence
+#endif
+ bool handleDeclOccurrence(const Decl *d, index::SymbolRoleSet roles,
+ ArrayRef<index::SymbolRelation> relations,
+ SourceLocation src_loc,
+ ASTNodeInfo ast_node) override {
     if (!param.no_linkage) {
       if (auto *nd = dyn_cast<NamedDecl>(d); nd && nd->hasLinkage())
         ;
diff -Nru ccls-0.20190823.5/src/main.cc ccls-0.20190823.6/src/main.cc
--- ccls-0.20190823.5/src/main.cc 2019-11-13 00:22:48.000000000 +0800
+++ ccls-0.20190823.6/src/main.cc 2020-04-22 15:02:27.000000000 +0800
@@ -140,7 +140,7 @@
     if (opt_index.size()) {
       SmallString<256> root(opt_index);
       sys::fs::make_absolute(root);
- pipeline::standalone(root.str());
+ pipeline::standalone(std::string(root.data(), root.size()));
     } else {
       // The thread that reads from stdin and dispatchs commands to the main
       // thread.
diff -Nru ccls-0.20190823.5/src/pipeline.cc ccls-0.20190823.6/src/pipeline.cc
--- ccls-0.20190823.5/src/pipeline.cc 2019-11-13 00:22:48.000000000 +0800
+++ ccls-0.20190823.6/src/pipeline.cc 2020-04-22 15:02:27.000000000 +0800
@@ -113,7 +113,7 @@
   }

   // For inferred files, allow -o a a.cc -> -o b b.cc
- std::string stem = sys::path::stem(path);
+ StringRef stem = sys::path::stem(path);
   int changed = -1, size = std::min(prev->args.size(), args.size());
   for (int i = 0; i < size; i++)
     if (strcmp(prev->args[i], args[i]) && sys::path::stem(args[i]) != stem) {
diff -Nru ccls-0.20190823.5/src/platform.hh ccls-0.20190823.6/src/platform.hh
--- ccls-0.20190823.5/src/platform.hh 2019-11-13 00:22:48.000000000 +0800
+++ ccls-0.20190823.6/src/platform.hh 2020-04-22 15:02:27.000000000 +0800
@@ -1,14 +1,14 @@
-// Copyright 2017-2018 ccls Authors
+// Copyright 2017-2020 ccls Authors
 // SPDX-License-Identifier: Apache-2.0

 #pragma once

+#include <llvm/ADT/StringRef.h>
+
 #include <string>
-#include <string_view>
-#include <vector>

 namespace ccls {
-std::string normalizePath(const std::string &path);
+std::string normalizePath(llvm::StringRef path);

 // Free any unused memory and return it to the system.
 void freeUnusedMemory();
diff -Nru ccls-0.20190823.5/src/platform_posix.cc ccls-0.20190823.6/src/platform_posix.cc
--- ccls-0.20190823.5/src/platform_posix.cc 2019-11-13 00:22:48.000000000 +0800
+++ ccls-0.20190823.6/src/platform_posix.cc 2020-04-22 15:02:27.000000000 +0800
@@ -40,7 +40,7 @@
 void threadEnter();
 }

-std::string normalizePath(const std::string &path) {
+std::string normalizePath(llvm::StringRef path) {
   llvm::SmallString<256> p(path);
   llvm::sys::path::remove_dots(p, true);
   return {p.data(), p.size()};
diff -Nru ccls-0.20190823.5/src/platform_win.cc ccls-0.20190823.6/src/platform_win.cc
--- ccls-0.20190823.5/src/platform_win.cc 2019-11-13 00:22:48.000000000 +0800
+++ ccls-0.20190823.6/src/platform_win.cc 2020-04-22 15:02:27.000000000 +0800
@@ -19,17 +19,12 @@
 #include <thread>

 namespace ccls {
-std::string normalizePath(const std::string &path) {
- DWORD retval = 0;
+std::string normalizePath(llvm::StringRef path) {
   TCHAR buffer[MAX_PATH] = TEXT("");
   TCHAR **lpp_part = {NULL};

- std::string result;
- retval = GetFullPathName(path.c_str(), MAX_PATH, buffer, lpp_part);
- // fail, return original
- if (retval == 0)
- result = path;
- else
+ std::string result(path);
+ if (GetFullPathName(result.c_str(), MAX_PATH, buffer, lpp_part) != 0)
     result = buffer;

   std::replace(result.begin(), result.end(), '\\', '/');
diff -Nru ccls-0.20190823.5/src/project.cc ccls-0.20190823.6/src/project.cc
--- ccls-0.20190823.5/src/project.cc 2019-11-13 00:22:48.000000000 +0800
+++ ccls-0.20190823.6/src/project.cc 2020-04-22 15:02:27.000000000 +0800
@@ -222,7 +222,7 @@
     return {};
   std::vector<const char *> args;
   for (line_iterator i(*mbOrErr.get(), true, '#'), e; i != e; ++i) {
- std::string line = *i;
+ std::string line(*i);
     doPathMapping(line);
     args.push_back(intern(line));
   }
@@ -632,7 +632,7 @@
 void Project::indexRelated(const std::string &path) {
   auto &gi = g_config->index;
   GroupMatch match(gi.whitelist, gi.blacklist);
- std::string stem = sys::path::stem(path);
+ StringRef stem = sys::path::stem(path);
   std::vector<const char *> args, extra_args;
   for (const std::string &arg : g_config->clang.extraArgs)
     extra_args.push_back(intern(arg));
diff -Nru ccls-0.20190823.5/src/sema_manager.cc ccls-0.20190823.6/src/sema_manager.cc
--- ccls-0.20190823.5/src/sema_manager.cc 2019-11-13 00:22:48.000000000 +0800
+++ ccls-0.20190823.6/src/sema_manager.cc 2020-04-22 15:02:27.000000000 +0800
@@ -9,6 +9,7 @@
 #include "pipeline.hh"
 #include "platform.hh"

+#include <clang/Basic/TargetInfo.h>
 #include <clang/Lex/PreprocessorOptions.h>
 #include <clang/Sema/CodeCompleteConsumer.h>
 #include <clang/Sema/Sema.h>
@@ -622,9 +623,10 @@
         for (const Note &n : d.notes) {
           SmallString<256> str(n.file);
           llvm::sys::path::remove_dots(str, true);
- Location loc{DocumentUri::fromPath(str.str()),
- lsRange{{n.range.start.line, n.range.start.column},
- {n.range.end.line, n.range.end.column}}};
+ Location loc{
+ DocumentUri::fromPath(std::string(str.data(), str.size())),
+ lsRange{{n.range.start.line, n.range.start.column},
+ {n.range.end.line, n.range.end.column}}};
           ls_diag.relatedInformation.push_back({loc, n.message});
         }
       } else {
diff -Nru ccls-0.20190823.5/src/serializer.cc ccls-0.20190823.6/src/serializer.cc
--- ccls-0.20190823.5/src/serializer.cc 2019-11-13 00:22:48.000000000 +0800
+++ ccls-0.20190823.6/src/serializer.cc 2020-04-22 15:02:27.000000000 +0800
@@ -1,4 +1,4 @@
-// Copyright 2017-2018 ccls Authors
+// Copyright 2017-2020 ccls Authors
 // SPDX-License-Identifier: Apache-2.0

 #include "serializer.hh"
@@ -13,6 +13,7 @@

 #include <llvm/ADT/CachedHashString.h>
 #include <llvm/ADT/DenseSet.h>
+#include <llvm/Support/Allocator.h>

 #include <mutex>
 #include <stdexcept>
@@ -216,7 +217,7 @@
   reflectMemberStart(vis);
   REFLECT_MEMBER(line);
   if (gTestOutputMode) {
- std::string basename = llvm::sys::path::filename(v.resolved_path);
+ std::string basename(llvm::sys::path::filename(v.resolved_path));
     if (v.resolved_path[0] != '&')
       basename = "&" + basename;
     REFLECT_MEMBER2("resolved_path", basename);
```

Revision history for this message
Shengjing Zhu (zhsj) wrote :

Hi Gianfranco,

I added you to the subscribers, since you maintains llvm in Ubuntu. I'm quite new to the Ubuntu procedure, could you help with this?

Revision history for this message
Hans Joachim Desserud (hjd) wrote :

Thanks for reporting.

>How does the SRU procedure work?

Please see https://wiki.ubuntu.com/StableReleaseUpdates#Procedure

tags: added: focal ftbfs patch
Changed in ccls (Ubuntu):
status: New → Fix Released
Changed in ccls (Ubuntu Focal):
status: New → In Progress
summary: - FTBFS with llvm-10
+ [SRU] ccls: FTBFS with llvm-10
description: updated
Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello Shengjing, or anyone else affected,

Accepted ccls into focal-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/ccls/0.20190823.6-1~ubuntu1.20.04.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-focal to verification-done-focal. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-focal. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in ccls (Ubuntu Focal):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-focal
Revision history for this message
Gianfranco Costamagna (costamagnagianfranco) wrote :

it works for me

apt-get dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done

Calculating upgrade... Done
The following package was automatically installed and is no longer required:
  libllvm9
Use 'sudo apt autoremove' to remove it.
The following NEW packages will be installed:
  libllvm10

The following packages will be upgraded:
  ccls
1 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 21.1 MB of archives.
After this operation, 75.4 MB of additional disk space will be used.
0% [Working]to continue? [Y/n]
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 libllvm10 amd64 1:10.0.0-4ubuntu1 [15.3 MB]
Get:2 http://archive.ubuntu.com/ubuntu focal-proposed/universe amd64 ccls amd64 0.20190823.6-1~ubuntu1.20.04.1 [5753 kB]
Fetched 9324 kB in 6s (1446 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libllvm10:amd64.
(Reading database ... 11501 files and directories currently installed.)
Preparing to unpack .../libllvm10_1%3a10.0.0-4ubuntu1_amd64.deb ...
Unpacking libllvm10:amd64 (1:10.0.0-4ubuntu1) ...
Preparing to unpack .../ccls_0.20190823.6-1~ubuntu1.20.04.1_amd64.deb ...
Unpacking ccls (0.20190823.6-1~ubuntu1.20.04.1) over (0.20190823.5-1) ...
Setting up libllvm10:amd64 (1:10.0.0-4ubuntu1) ...
Setting up ccls (0.20190823.6-1~ubuntu1.20.04.1) ...
Processing triggers for libc-bin (2.31-0ubuntu9) ...
root@Unimatrix05-Bionic:/# ccls --version
ccls version 0.20190823.6-1~ubuntu1.20.04.1
clang version 10.0.0-4ubuntu1

tags: added: verification-done verification-done-focal
removed: verification-needed verification-needed-focal
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ccls - 0.20190823.6-1~ubuntu1.20.04.1

---------------
ccls (0.20190823.6-1~ubuntu1.20.04.1) focal; urgency=medium

  * SRU the bugfix release to make it compatible with default llvm-10
    fixing a FTBFS (LP: #1874508)

 -- Gianfranco Costamagna <email address hidden> Fri, 12 Jun 2020 22:31:35 +0200

Changed in ccls (Ubuntu Focal):
status: Fix Committed → Fix Released
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Update Released

The verification of the Stable Release Update for ccls has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.