Giter Club home page Giter Club logo

elixir's Introduction

The Elixir Cross Referencer

Build Status

Elixir is a source code cross-referencer inspired by LXR. It’s written in Python and its main purpose is to index every release of a C or C++ project (like the Linux kernel) while keeping a minimal footprint.

It uses Git as a source-code file store and Berkeley DB for cross-reference data. Internally, it indexes Git blobs rather than trees of files to avoid duplicating work and data. It has a straightforward data structure (reminiscent of older LXR releases) to keep queries simple and fast.

You can see it in action on https://elixir.bootlin.com/

Note
this documentation applies to version 2.0 of Elixir.

Requirements

  • Python >= 3.6

  • Git >= 1.9

  • The Jinja2 and Pygments (>= 2.7) Python libraries

  • Berkeley DB (and its Python binding)

  • Universal Ctags

  • Perl (for non-greedy regexes and automated testing)

  • Falcon and mod_wsgi (for the REST API)

Architecture

Elixir has the following architecture:

.---------------.----------------.
| CGI interface | REST interface |
|---------------|----------------.
| Query command | Update command |
|---------------|----------------|
|          Shell script          |
'--------------------------------'

The shell script (script.sh) is the lower layer and provides commands to interact with Git and other Unix utilities. The Python commands use the shell script’s services to provide access to the annotated source code and identifier lists (query.py) or to create and update the databases (update.py). Finally, the CGI interface (web.py) and the REST interface (api.py) use the query interface to generate HTML pages and to answer REST queries, respectively.

When installing the system, you should test each layer manually and make sure it works correctly before moving on to the next one.

Database design

./update.py stores a bidirectionnal mapping between git object hashes ("blobs") and a sequential key. The goal of indexing such hashes is to reduce their storage footprint (20 bytes for a SHA-1 hash versus 4 bytes for a 32 bit integer).

A detailed diagram of the databases will be provided. Until then, just use the Source, Luke.

Manual Installation

Install Dependencies

For RedHat/Fedora/AlmaLinux

sudo dnf install python36-pip python36-pytest python36-jinja2 python36-bsddb3 python36-falcon python3-pygments git httpd perl perl-autodie jansson libyaml rh-python36-mod_wsgi

For Debian

sudo apt install python3-jinja2 python3-bsddb3 python3-falcon python3-pytest python3-pygments universal-ctags perl git apache2 libapache2-mod-wsgi-py3 libjansson4

To enable the REST API, follow the installation instructions on mod_wsgi and connect it to the apache installation as detailed in https://github.com/GrahamDumpleton/mod_wsgi#connecting-into-apache-installation.

To know which packages to install, you can also read the Docker files in the docker/ directory to know what packages Elixir needs in your favorite distribution.

Download Elixir Project

git clone https://github.com/bootlin/elixir.git /usr/local/elixir/

Create Directory

mkdir -p /path/elixir-data/linux/repo
mkdir -p /path/elixir-data/linux/data

Set environment variables

Two environment variables are used to tell Elixir where to find the project’s local git repository and its databases:

  • LXR_REPO_DIR (the git repository directory for your project)

  • LXR_DATA_DIR (the database directory for your project)

Now open /etc/profile and append the following content.

export LXR_REPO_DIR=/path/elixir-data/linux/repo
export LXR_DATA_DIR=/path/elixir-data/linux/data

And then run source /etc/profile.

Clone Kernel source code

First clone the master tree released by Linus Torvalds:

cd /path/elixir-data/linux
git clone --bare https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git repo

Then, you should also declare a stable remote branch corresponding to the stable tree, to get all release updates:

cd repo
git remote add stable git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
git fetch stable

Then, you can also declare an history remote branch corresponding to the old Linux versions not present in the other repos, to get all the old version still available:

cd repo
git remote add history https://github.com/bootlin/linux-history.git
git fetch history --tags

Feel free to add more remote branches in this way, as Elixir will consider tags from all remote branches.

First Test

cd /usr/local/elixir/
./script.sh list-tags

Create Database

./update.py <number of threads>

Generating the full database can take a long time: it takes about 15 hours on a Xeon E3-1245 v5 to index 1800 tags in the Linux kernel. For that reason, you may want to tweak the script (for example, by limiting the number of tags with a "head") in order to test the update and query commands. You can even create a new Git repository and just create one tag instead of using the official kernel repository which is very large.

Second Test

Verify that the queries work:

$ ./query.py v4.10 ident raw_spin_unlock_irq C
$ ./query.py v4.10 file /kernel/sched/clock.c
Note
v4.10 can be replaced with any other tag.

Configure httpd

The CGI interface (web.py) is meant to be called from your web server. Since it includes support for indexing multiple projects, it expects a different variable (LXR_PROJ_DIR) which points to a directory with a specific structure:

  • <LXR_PROJ_DIR>

    • <project 1>

      • data

      • repo

    • <project 2>

      • data

      • repo

    • <project 3>

      • data

      • repo

It will then generate the other two variables upon calling the query command.

Now open /etc/httpd/conf.d/elixir.conf and write the following content. Note: If using apache2 (Ubuntu/Debian) instead of httpd (RedHat/Centos), the default config file to edit is: /etc/apache2/sites-enabled/000-default.conf

HttpProtocolOptions Unsafe
# Required for HTTP
<Directory /usr/local/elixir/http/>
    Options +ExecCGI
    AllowOverride None
    Require all granted
    SetEnv PYTHONIOENCODING utf-8
    SetEnv LXR_PROJ_DIR /path/elixir-data
</Directory>

# Required for the REST API
<Directory /usr/local/elixir/api/>
    SetHandler wsgi-script
    Require all granted
    SetEnv PYTHONIOENCODING utf-8
    SetEnv LXR_PROJ_DIR /path/elixir-data
</Directory>

AddHandler cgi-script .py
#Listen 80
<VirtualHost *:80>
    ServerName xxx
    DocumentRoot /usr/local/elixir/http

    # To enable REST api after installing mod_wsgi: Fill path and uncomment:
    #WSGIScriptAlias /api /usr/local/elixir/api/api.py

    AllowEncodedSlashes On

    RewriteEngine on
    RewriteRule "^/$" "/linux/latest/source" [R]
    RewriteRule "^/(?!api|acp).*/(source|ident|search)" "/web.py" [PT]
    RewriteRule "^/acp" "/autocomplete.py" [PT]
</VirtualHost>

cgi and rewrite support has been enabled by default in RHEL/CentOS, but you should enable it manually if your distribution is Debian/Ubuntu.

a2enmod cgi rewrite

Finally, start the httpd server.

systemctl start httpd

Configure SELinux policy

When running systemd with SELinux enabled, httpd server can only visit limited directories. If your /path/elixir-data/ is not one of these allowed directories, you will be responded with 500 status code.

To allow httpd server to visit /path/elixir-data/, run following codes:

chcon -R -t httpd_sys_rw_content_t /path/elixir-data/

To check if it takes effect, run the following codes:

ls -Z /path/elixir-data/

In case you want to check SELinux log related with httpd, run the following codes:

audit2why -a | grep httpd | less

Configure systemd log directory

By default, the error log of elixir will be put in /tmp/elixir-errors. However, systemd enables PrivateTmp by default. And, the final error directory will be like /tmp/systemd-private-xxxxx-httpd.service-xxxx/tmp/elixir-errors. If you want to disable it, configure httpd.service with the following attribute:

PrivateTmp=false

Configure lighthttpd

Here’s a sample configuration for lighthttpd:

server.document-root = server_root + "/elixir/http"
url.redirect = ( "^/$" => "/linux/latest/source" )
url.rewrite  = ( "^/(?!api|acp).*/(source|ident|search)" =>  "/web.py/$1")
url.rewrite  = ( "^/acp" =>  "/autocomplete.py")
setenv.add-environment = ( "PYTHONIOENCODING" => "utf-8",
    "LXR_PROJ_DIR" => "/path/to/elixir-data" )

REST API usage

After configuring httpd, you can test the API usage:

ident query

Send a get request to /api/ident/<Project>/<Ident>?version=<version>&family=<family>. For example:

curl http://127.0.0.1/api/ident/barebox/cdev?version=latest&family=C

The response body is of the following structure:

{
    "definitions":
        [{"path": "commands/loadb.c", "line": 71, "type": "variable"}, ...],
    "references":
        [{"path": "arch/arm/boards/cm-fx6/board.c", "line": "64,64,71,72,75", "type": null}, ...]
}

Maintenance and enhancements

Using a cache to improve performance

At Bootlin, we’re using the Varnish http cache as a front-end to reduce the load on the server running the Elixir code.

.-------------.           .---------------.           .-----------------------.
| Http client | --------> | Varnish cache | --------> | Apache running Elixir |
'-------------'           '---------------'           '-----------------------'

Keeping Elixir databases up to date

To keep your Elixir databases up to date and index new versions that are released, we’re proposing to use a script like utils/update-elixir-data which is called through a daily cron job.

You can set $ELIXIR_THREADS if you want to change the number of threads used by update.py for indexing (by default the number of CPUs on your system).

Keeping git repository disk usage under control

As you keep updating your git repositories, you may notice that some can become considerably bigger than they originally were. This seems to happen when a gc.log file appears in a big repository, apparently causing git’s garbage collector (git gc) to fail, and therefore causing the repository to consume disk space at a fast pace every time new objects are fetched.

When this happens, you can save disk space by packing git directories as follows:

cd <bare-repo>
git prune
rm gc.log
git gc --aggressive

Actually, a second pass with the above commands will save even more space.

To process multiple git repositories in a loop, you may use the utils/pack-repositories that we are providing, run from the directory where all repositories are found.

Building Docker images

Docker files are provided in the docker/ directory. To generate a Docker image for indexing the sources of a project, first fetch the Elixir repository. Then pick the project you want to index (Musl is nice test data being not too slow to index) and your target distribution (debian currently), and run:

$ docker build -t elixir-debian --build-arg GIT_REPO_URL=git://git.musl-libc.org/musl --build-arg PROJECT=musl ./docker/debian/

Then you can use your new container as follows (you get the container id from the output of docker build):

$ docker run <container-id>

You can the open the below URL in a browser on your host: http://172.17.0.2/musl/latest/source (change the container IP address if you don’t get the default one)

Hardware requirements

Performance requirements depend mostly on the amount of traffic that you get on your Elixir service. However, a fast server also helps for the initial indexing of the projects.

SSD storage is strongly recommended because of the frequent access to git repositories.

At Bootlin, here are a few details about the server we’re using:

  • As of July 2019, our Elixir service consumes 17 GB of data (supporting all projects), or for the Linux kernel alone (version 5.2 being the latest), 12 GB for indexing data, and 2 GB for the git repository.

  • We’re using an LXD instance with 8 GB of RAM on a cloud server with 8 CPU cores running at 3.1 GHz.

Contributing to Elixir

Supporting a new project

Elixir has a very simple modular architecture that allows to support new source code projects by just adding a new file to the Elixir sources.

Elixir’s assumptions:

  • Project sources have to be available in a git repository

  • All project releases are associated to a given git tag. Elixir only considers such tags.

First make an installation of Elixir by following the above instructions. See the projects subdirectory for projects that are already supported.

Once Elixir works for at least one project, it’s time to clone the git repository for the project you want to support:

cd /srv/git
git clone --bare https://github.com/zephyrproject-rtos/zephyr

After doing this, you may also reference and fetch remote branches for this project, for example corresponding to the stable tree for the Linux kernel (see the instructions for Linux earlier in this document).

Now, in your LXR_PROJ_DIR directory, create a new directory for the new project:

cd $LXR_PROJ_DIR
mkdir -p zephyr/data
ln -s /srv/git/zephyr.git repo
export LXR_DATA_DIR=$LXR_PROJ_DIR/data
export LXR_REPO_DIR=$LXR_PROJ_DIR/repo

Now, go back to the Elixir sources and test that tags are correctly extracted:

./script.sh list-tags

Depending on how you want to show the available versions on the Elixir pages, you may have to apply substitutions to each tag string, for example to add a v prefix if missing, for consistency with how other project versions are shown. You may also decide to ignore specific tags. All this can be done by redefining the default list_tags() function in a new projects/<projectname>.sh file. Here’s an example (projects/zephyr.sh file):

list_tags()
{
    echo "$tags" |
    grep -v '^zephyr-v'
}

Note that <project_name> must match the name of the directory that you created under LXR_PROJ_DIR.

The next step is to make sure that versions are classified as you wish in the version menu. This classification work is done through the list_tags_h() function which generates the output of the ./scripts.sh list-tags -h command. Here’s what you get for the Linux project:

v4 v4.16 v4.16
v4 v4.16 v4.16-rc7
v4 v4.16 v4.16-rc6
v4 v4.16 v4.16-rc5
v4 v4.16 v4.16-rc4
v4 v4.16 v4.16-rc3
v4 v4.16 v4.16-rc2
v4 v4.16 v4.16-rc1
...

The first column is the top level menu entry for versions. The second one is the next level menu entry, and the third one is the actual version that can be selected by the menu. Note that this third entry must correspond to the exact name of the tag in git.

If the default behavior is not what you want, you will have to customize the list_tags_h function.

You should also make sure that Elixir properly identifies the most recent versions:

./script.sh get-latest

If needed, customize the get_latest() function.

If you want to enable support for compatible properties in Devicetree files, add dts_comp_support=1 at the beginning of projects/<projectname>.sh.

You are now ready to generate Elixir’s database for your new project:

./update.py <number of threads>

You can then check that Elixir works through your http server.

Coding style

If you wish to contribute to Elixir’s Python code, please follow the official coding style for Python.

How to send patches

The best way to share your contributions with us is to file a pull request on GitHub.

Automated testing

Elixir includes a simple test suite in t/. To run it, from the top-level Elixir directory, run:

prove

The test suite uses code extracted from Linux v5.4 in t/tree.

Licensing of code in t/tree

The copied code is licensed as described in the COPYING file included with Linux. All the files copied carry SPDX license identifiers of GPL-2.0+ or GPL-2.0-or-later. Per GNU’s compatibility table, GPL 2.0+ code can be used under GPLv3 provided the combination is under GPLv3. Moreover, GNU’s overview of AGPLv3 indicates that its terms "effectively consist of the terms of GPLv3" plus the network-use paragraph. Therefore, the developers have a good-faith belief that licensing these files under AGPLv3 is authorized. (See also this issue comment for another example of a similar situation.)

License

Elixir is copyright (c) 2017—​2020 its contributors. It is licensed AGPLv3. See the COPYING file included with Elixir for details.

elixir's People

Contributors

anatasluo avatar carmeli-tamir avatar cxw42 avatar darx0r avatar dcsouthwick avatar dtenebrae avatar eknoes avatar frhun avatar fstachura avatar jmaselbas avatar jvoisin avatar kezii avatar llccd avatar makelinux avatar maximechretien avatar mlerner avatar mwalle avatar nkaje avatar pan-ziyue avatar pcworld avatar plaes avatar pokazef avatar royger avatar silvio avatar stdk avatar tleb avatar vincehillier avatar wens avatar xrmx avatar zo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

elixir's Issues

Tabs in kernel source is showing as 4 spaces, not 8

As we all know, the correct indentation for tabs in kernel sources is 8, not 4.

One bad side affect is that some previously correctly lined up comments and code are now incorrect when viewing online.

Oh and if anyone ever cuts/pastes from the web view, it will be totally incorrect in their editor :)

Error 500 because of invalid headers

It seems that something went wrong when creating the database of PHP, because elixir produces non-working pages:

==> /var/log/apache2/error.log <==
[Tue Jun 27 08:42:12.979348 2017] [http:error] [pid 11443:tid 116669335639808] [client 192.168.135.96:60244] AH02429: Response header name '<!--' contains invalid characters, aborting request, referer: http://10.1.76.1/php/php-7.1.6/ident/zend_string

==> /var/log/apache2/other_vhosts_access.log <==
elixir.example.com:80 192.168.135.96 - - [27/Jun/2017:08:42:12 +0000] "GET /php/php-7.1.6/source/Zend/zend_API.c HTTP/1.1" 500 777 "http://10.1.76.1/php/php-7.1.6/ident/zend_string" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/58.0.3029.110 Chrome/58.0.3029.110 Safari/537.36"

Here is my Apache2 configuration:

<Directory /data/git/elixir/http/>
    Options +ExecCGI
    AllowOverride None
    Require all granted
    SetEnv PYTHONIOENCODING utf-8
    SetEnv LXR_PROJ_DIR /data/git/elixir-data
</Directory>

AddHandler cgi-script .py

<VirtualHost *:80>
    ServerName elixir.example.com
    DocumentRoot /data/git/elixir/http

    RewriteEngine on
    RewriteRule "^/$" "/php/latest/source" [R]
    RewriteRule "^/.*/(source|ident|search)" "/web.py" [PT]
</VirtualHost>

Remove spaces before identifier's name before searching the database

I am frequent user of elixir and one issue that I encountered is while searching for an identifier if I put a space before the identifier's name in Search Identifier box, it does not show any results.
If I search the same identifier without a space before the name, I get results.
So, while searching for the identifier in the db, spaces before the identifier should be removed first.

I can create a PR proposing this fix.

Searching without space: string == "fpga_bridge_ops"
selection_056

Searching with space: string == " fpga_bridge_ops"
selection_057

web.py could not work.

It gets error while acceess the eos project with follow url
http://192.168.50.159/lxr-eos/latest/source

But access the zephyr project is good.
http://192.168.50.159/zephyr/latest/source

The web page report:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at root@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

I got the follow error from apache error_log:

[Fri Jun 29 20:47:49.231913 2018] [http:error] [pid 775] [client 192.168.50.97:51215] AH02429: Response header name '<!--' contains invalid characters, aborting request

My environment:
OS: centos7
web server: apache 2.4.6
my apahce config file:
[root@localhost httpd]# cat sites-available/lxr.eos.conf

<VirtualHost *:80>
    ServerName lxr.eos.com
    DocumentRoot "/data/app/workspace/git/elixir/http"

    RewriteEngine on
    RewriteRule "^/$" "/lxr-eos/latest/source" [R]
    RewriteRule "^/.*/(source|ident|search)" "/web.py" [PT]
    <Directory "/data/app/workspace/git/elixir/http">
        Options Indexes FollowSymLinks ExecCGI
        AllowOverride All
        AddHandler cgi-script .cgi .py
        Require all granted
        SetEnv PYTHONIOENCODING utf-8
        SetEnv LXR_PROJ_DIR /data/home/jiaxi/workspace/job
    </Directory>
</VirtualHost>

project directory(contains zephyr and eos):
[root@localhost httpd]# ls ~jiaxi/workspace/job/zephyr/
data repo

[jiaxi@localhost elixir]$ ls ~/workspace/job/lxreos/
data repo

any suggestion is good, thanks.

Make code selectable without line numbers

Right now, you can't copy-paste code because the line numbers are included in the selection. This could be fixed by displaying the line numbers and the code inside a two-column invisible table but proper alignment must be ensured.

Incomplete definition match

In Linux 4.9, the "vb2_queue" identifier should be recognized in include/media/videobuf2-core.h both as a struct (line 493) and as a struct member (line 242), but only the later is actually reported.

Stacktrace when running elixir on php's source code

Hello,
I have a reproductible stacktrace when running elixir on php-src

D: 15100
Traceback (most recent call last):
  File "./update.py", line 141, in <module>
    updateDefinitions (newBlobs)
  File "./update.py", line 84, in updateDefinitions
    line = int (line.decode())
ValueError: invalid literal for int() with base 10: 'function'

SCRIPT_URL in web.py?

Hi

First of all, I'm completely not aware of Apache server configurations, so this might be a simple PEBKAC. I did follow all steps of the installation manual. My server (httpd) is up and running, however I'm getting an error when it want to run web.py, since there's no SCRIPT_URL variable set. What should be the proper value for this variable? Should I set it or it should be somehow set automatically by httpd? Below is the tree of the test linux repository I'm trying to run. I've only modified elixir scripts a little, to return just 2 of the tags instead of all of them. Rest is unchanged.

(all Linux data is inside the "repo" directory - this is wrongly presented here)
user@server:~/data/proj_elixir$ tree -L 3
.
└── linux
├── data
│   ├── blobs.db
│   ├── definitions.db
│   ├── filenames.db
│   ├── hashes.db
│   ├── references.db
│   ├── variables.db
│   └── versions.db
└── repo
├── arch
├── block
├── certs
├── COPYING
├── CREDITS
├── crypto
├── Documentation
├── drivers
├── firmware
├── fs
├── include
├── init
├── ipc
├── Kbuild
├── Kconfig
├── kernel
├── lib
├── MAINTAINERS
├── Makefile
├── mm
├── net
├── README
├── samples
├── scripts
├── security
├── sound
├── tools
├── usr
└── virt

Kernel config options

Usually searching some kernel config as identifier doesn't work, so "https://elixir.bootlin.com/linux/latest/ident/CONFIG_SCHEDSTATS" returns empty page.

But today I found it works with some kernel config like "https://elixir.bootlin.com/linux/latest/ident/CONFIG_PARAVIRT" and I think the reason is that it has something like "#undef CONFIG_PARAVIRT" in the code.

Then can we make it available generally for "#ifdef xxx"?
Use case: As mentioned, we can check the code very easily which is dependent to a certain kernel config in Linux kernel source tree.

supporting more file name extensions, plus cases

browsing through the code I saw the following:

ext = filename[-2:]
if not (ext == '.c' or ext == '.h'): continue

There are a few things that I think could be improved there. First of all, it ignores the cases of extensions: files that end with '.C' or '.H' are ignored. Second, it would be good to have more extensions, such as:

  • .S (for assembler)
  • .cxx, .c++, etc for C++ files

I would suggest to rsplit() the file name on the '.' character and check if the extension is in a supported list of extensions.

pre-generate all source file pages

I built a cross referencer site for kernel and glibc using elixir.
But I noticed that the load time of a page is very long about 500ms.
So can we support pre generate output of a source file to a static file, then we can load it without dynamic generate , that will speed up the visit time

Wrong/missing indexing after double quote character

In kernel/trace/trace_events.c in Linux, around 1300 lines are not properly indexed.

The problem starts here: https://elixir.bootlin.com/linux/v4.17/source/kernel/trace/trace_events.c#L2149
and seems to fix itself about 1300 lines later: https://elixir.bootlin.com/linux/v4.17/source/kernel/trace/trace_events.c#L3412

I strongly suspect the double quote (if (*ptr == '"') {) in the initial line to be the culprit, probably confusing the parser what's inside a string and what's not - this also causes some strings inside the faulty range to have links in them (e.g.,
https://elixir.bootlin.com/linux/v4.17/source/kernel/trace/trace_events.c#L3159)

Add function pointers in structs as symbols to search for

Reported by Jan Sokolowski (thanks!)


I've got a question, as a person who often has to browse linux kernel
elixir when debugging a kernel: Is it possible to add function
pointers in structs as symbols to search for?

For example: in net_device_ops:
https://elixir.bootlin.com/linux/v5.1-rc4/source/include/linux/netdevice.h#L1259
I'd like to know where ndo_init is called throughout the kernel by
clicking on it.

Is it possible to add this feature?

[BUG] IndexError: list index out of range

I tried the docker image on my code repo other than Linux kernel repository.

I enabled debug in web.py and output the error log to /tmp folder.

import cgitb
cgitb.enable(display=0, logdir='/tmp')

Here is the error I got from html page /tmp/tmp32xjo7k5.html:

...
<!-- The above is a description of an error in a Python program, formatted
     for a Web browser because the 'cgitb' module was enabled.  In case you
     are not reading this in a Web browser, here is the original traceback:

Traceback (most recent call last):
  File "/usr/local/elixir/http/web.py", line 138, in &lt;module&gt;
    lines = do_query ('versions')
  File "/usr/local/elixir/http/web.py", line 109, in do_query
    a = query.query (*args)
  File "/usr/local/elixir/http/../query.py", line 44, in query
    if db.vers.exists (p.split(b' ')[2]):
IndexError: list index out of range

-->

Tagging Level Parsing Fails when the tags don't follow 3 level format

In projects that have tags that don't follow v3 v3.1 v3.1-rc10 format, the system raises
the following issue. This is observed on 96316cd0b84bfd129f8c5dbc6be77df1a516c780. Works ok on v0.3

A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.
 /home/naveen/workspace/elixir/http/web.py in <module>()
    129 }
    130 
=>  131 versions = call_query ('versions')
    132 
    133 v = ''
versions undefined, call_query = <function call_query>
 /home/naveen/workspace/elixir/http/web.py in call_query(*args=('versions',))
    108     cwd = os.getcwd()
    109     os.chdir ('..')
=>  110     ret = query.query (*args)
    111     os.chdir (cwd)
    112 
ret undefined, global query = <module 'query' from '/home/naveen/workspace/elixir/http/../query.py'>, query.query = <function query>, args = ('versions',)
 /home/naveen/workspace/elixir/query.py in query(cmd='versions', *args=())
     53         for line in scriptLines ('list-tags', '-h'):
     54             decoded_line = decode(line)
=>   55             topmenu, submenu, tag = decoded_line.split(' ')
     56             if db.vers.exists (tag):
     57                 if topmenu not in versions:
topmenu undefined, submenu undefined, tag undefined, decoded_line = 'Tag_V1', decoded_line.split = <built-in method split of str object>

Missing diff option

The feature I liked the most of the old system was the ability to diff through the versions particularly when trying to find when something was changed. While I like the layout of the new system since you can fit a bunch more versions, it's not usable to me without the diff feature.

Thanks.

Expose rest/json api for elixir

Hi,
Are there plans to expose an API for elixir? (e.g. get_symbol_definition, get_all_references)
If so I'd be willing to contribute.
Thanks!

Links from Identifier Search off by 4 lines.

Searching for "SND_SOC_DAPM_POST_PMU" yields a number of hits:

http://elixir.free-electrons.com/linux/v4.10/ident/SND_SOC_DAPM_POST_PMU

Clicking on "line 217" from "include/sound/soc-dapm.h" appears to take me to line 217:

http://elixir.free-electrons.com/linux/v4.10/source/include/sound/soc-dapm.h#L217

However, the reference seems to be on line 213.

Scrolling to the top of the file, I can see that the line numbering isn't aligned with the lines of the file.

Viewing on Google Chrome, Version 56.0.2924.87 (64-bit), on Linux.

Checking line numbers from content management system displays

I came along a source file where I would like to refer to the beginning of the function “write_regs” (for a corresponding software development discussion).
It seems that the following links would be appropriate in principle at the moment.

Now I wonder about the shown line numbers. How could they be different when they should refer to the same source code place according to the used version tag?

Elixir docker error

I have built Elixir docker using docker/Dockerfile

When running it, and trying to access localhost:8080 apache reports an internal server error

In apache error.log it is detailed:
AH02429: Response header name '<!--' contains invalid characters, aborting request

in the docker container at apache.conf there is:
-e
HttpProtocolOptions Unsafe

it seems as HttpProtocolOptions Unsafe it is not solving it.

Apache version in the docker image is:
apachectl -v
Server version: Apache/2.4.25 (Debian)
Server built: 2018-11-03T18:46:19

Trouble with directory URLs

Hello,

This URL used to work:
http://lxr.free-electrons.com/source/arch/sh

But not this one:
http://elixir.free-electrons.com/source/arch/sh

The trailing / is required in Elixir. Would it be possible to support the absence of "/" in Elixir too?

Don't do this if this is expensive to implement or hurts the simplicity of the code. I'm not even sure directory URLs without the trailing / were used by LXR users (as the links provided by LXR did contain the / character at the end.

Michael.

README Out of Date

Hi, I've been working on setting up my own copy of Elixir with the Linux kernel and discovered that the README.md file is out of date and no longer reflects how Elixir is set up and configured.

  1. Elixir also depends on the jinja2 and pygments python libraries which are not mentioned in the README.

  2. The example Apache configuration uses the LXR_DATA_DIR and LXR_REPO_DIR for configuration (just like update.py), however web.py overrides those environment variables based on what's in the undocumented LXR_PROJ_DIR environment variable. This also has the side effect that web.py requires the data and repo directories to be in a specific (and undocumented) structure.

    So consequently, the example directory structure of LXR_DATA_DIR=/srv/elixir-data, LXR_REPO_DIR=/srv/git/linux will not work (as it differs from web.py's assumed directory structure).

  3. The URL scheme in the example Apache configuration also differs from what web.py uses. For example, to access v4.10 of the linux kernel source code, the example configuration uses ^/source, ^/ident, etc. whereas web.py uses ^/linux/v4.10/source, ^/linux/v4.10/ident, etc.

Handling filenames with spaces

Attempting to update a repo that contains files with spaces in their names results in the following output`

stdk@stdk:~/dev/elixir$ ./update.py
Found 2 new tags
initial: Traceback (most recent call last):
  File "./update.py", line 138, in <module>
    newBlobs = updateBlobIDs (tag)
  File "./update.py", line 46, in updateBlobIDs
    hash, filename = blob.split (b' ')
ValueError: too many values to unpack (expected 2)

Repository that produces such behaviour can be created in the following way:

# git init
# echo "int main() { return 0; }" > "Spaces included.c"
# git add "Spaces included.c"
# git commit -m "Initial"

Searching for implementations of message output functions

I would like to look at implementations of functions which output diagnostic information. Now I observe that a search by your evolving cross reference tool for a function like “dev_notice” points the header file “device.h” out. I would expect that another source file which contains corresponding implementations will be shown.

How are the chances that the software situation can be improved further similar to information in the previous bug report “Identifier search doesn't find all function occurrences”?

linenumbers and content do not fit

Hi there!
Thanks for your hard work :)

Unfortunately it seems that on my system (latest linux, lastest chromium browser)
the line numbering does not fit the contents...

As you can see here, line 116 should be struct bus_type {

image

When I can be of any help, please tell me!

Installation _Ubuntu 16.04 LTS

Hi sorry to bother (new to linux, apache python etc)

does anybody have a guide for ubuntu 16.04 LTS ?

Problem is installed everything on user Document folder ./script.sh and update.py and they work
database is created (at least I can see the files) but Apache doesnt find the web.py. Tried a lot of configuration but no luck.

Kind of Ubuntu tries to store webpages in var/www/html tried that way but wasnt able even to set env path so no way to run script.sh.

Any hint suggestion ? thanks P.

References of struct inode are not found

Hi!

I was looking for all references of a certain struct in the Linux Kernel when I found out that
exlixir does not list all of them.
If I search for super_block, for example, I do get a list of references:
https://elixir.bootlin.com/linux/v4.19-rc6/ident/super_block
It works as expected for typedefs as well:
https://elixir.bootlin.com/linux/v4.19-rc6/ident/journal_t

However, if I search for inode, I just get the definition of struct inode:
https://elixir.bootlin.com/linux/v4.19-rc6/ident/inode

I suppose this is a bug in the update mechanism.

Regards,
Alex

No feedback on selected version

Right now, the only way to know which version is currently selected is through the URL. The currently selected version should be displayed in the page itself.

Installation Instructions

Debian Web Server

Need to migrate to debian testing to get python3.5, Doesn't work with python3.4.

As root :
root@debian:~ git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
root@debian:~ git clone https://github.com/free-electrons/elixir.git
root@debian:~ aptitude install python3 python3-pygments python3-jinja2 exuberant-ctags kamailio-berkeley-modules python3-bsddb3

root@debian:~ mkdir /root/data
root@debian:~ export LXR_REPO_DIR=/root/linux
root@debian:~ export LXR_DATA_DIR=/root/data

root@debian:~ cd elixir
root@debian:~ ./update.py #changed update.py to create only the last tag
root@debian:~ mv /root/linux/ /srv/elixir-data/linux/repo
root@debian:~ mv /root/data /srv/elixir-data/linux/
root@debian:~ mv /root/elixir/ /usr/local/

Add to apache2.conf :

<Directory /usr/local/elixir/http/>
    Options +ExecCGI
    AllowOverride None
    Require all granted
    SetEnv PYTHONIOENCODING utf-8
    SetEnv LXR_PROJ_DIR /srv/elixir-data
</Directory>

AddHandler cgi-script .py

<VirtualHost *:80>
    ServerName MY_LOCAL_IP
    DocumentRoot /usr/local/elixir/http

    RewriteEngine on
    RewriteRule "^/$" "/linux/latest/source" [R]
    RewriteRule "^/.*/(source|ident|search)" "/web.py" [PT]
</VirtualHost>

root@debian:~ a2enmod rewrite
root@debian:~ a2enmod cgi
root@debian:~ systemctl restart apache2

add mercurial support

Before I might give it a try, looking at script.sh (which adds the 'git' support to elixir, right?), I believe it would be fairly easy to add hg support? Any suggestions?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.