Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
1
votes
2
answers
93
views
How to get bash script's current line contents being processed prior to interpretation?
When using `bash -x` or `set -x` in a script the output shows the result of the line being processed but not the source line which produced the result. There are times when knowing this as well could save time by not having to cross-reference the script with its output. For example, if variable "x"...
When using
bash -x
or set -x
in a script the output shows the result of the line being processed but not the source line which produced the result. There are times when knowing this as well could save time by not having to cross-reference the script with its output.
For example, if variable "x" currently has a value of 1 then source line x=$((x+1))
shows x=2
without revealing how the result was obtained - it could have been a simple x=2
assignment. Limited testing also indicates that there is no difference between the output of a while loop and the equivalent series of if tests.
Is there any facility in bash which will return the "pre-interpreted" source line for display?
Senior Geek
(91 rep)
Nov 19, 2024, 08:05 PM
• Last activity: Nov 20, 2024, 07:03 AM
0
votes
0
answers
30
views
Failed to run 'splint' to check code in embedded project
I am working on an embedded Linux system (kernel-5.10.24) on an SOC platform. Now I am trying to use splint to do code analysis, but I hit parse errors. I am using GNU toolchains for the SOC (mips), and the command line of splint is as follows, ``` splint -Iout/buildroot/usr/include/ -I/home/dev/mip...
I am working on an embedded Linux system (kernel-5.10.24) on an SOC platform. Now I am trying to use splint to do code analysis, but I hit parse errors.
I am using GNU toolchains for the SOC (mips), and the command line of splint is as follows,
splint -Iout/buildroot/usr/include/ -I/home/dev/mips-gcc/mips-linux-gnu/libc/usr/include/ -preproc -nestcomment -skipposixheaders -skipisoheaders +
trytorecover +posixlib test_project/src/*.c
And I got following error,
Splint 3.1.2 --- 20 Feb 2018
Command Line: Setting -skipposixheaders redundant with current value
out/buildroot/usr/include/bits/types.h:145:24: Parse Error: Non-function declaration:
__STD_TYPE : int. Attempting to continue.
out/buildroot/usr/include/bits/types.h:149:34: Cannot recover from parse error.
*** Cannot continue.
I checked the types.h
, and got,
141 #include /* Defines __*_T_TYPE macros. */
142 #include /* Defines __TIME*_T_TYPE macros. */
143
144
145 __STD_TYPE __DEV_T_TYPE __dev_t; /* Type of device numbers. */
146 __STD_TYPE __UID_T_TYPE __uid_t; /* Type of user identifications. */
147 __STD_TYPE __GID_T_TYPE __gid_t; /* Type of group identifications. */
148 __STD_TYPE __INO_T_TYPE __ino_t; /* Type of file serial numbers. */
149 __STD_TYPE __INO64_T_TYPE __ino64_t; /* Type of file serial numbers (LFS).*/
150 __STD_TYPE __MODE_T_TYPE __mode_t; /* Type of file attribute bitmasks. */
151 __STD_TYPE __NLINK_T_TYPE __nlink_t; /* Type of file link counts. */
152 __STD_TYPE __OFF_T_TYPE __off_t; /* Type of file sizes and offsets. */
I don't know how to fix this issue, and run splint to check my embedded projects.
wangt13
(631 rep)
Sep 26, 2024, 12:38 AM
• Last activity: Sep 26, 2024, 04:39 AM
0
votes
1
answers
40
views
How do I reverse a wine install?
I have built wine, the windows emulator from source with a specific *patch*. Now accidentally the source directory is removed, after I already run `sudo make install`. Is there a way to 'reverse' the install, resulting in an archive or folder? Could I copy over to other (Linux) machines and end up w...
I have built wine, the windows emulator from source with a specific *patch*.
Now accidentally the source directory is removed, after I already run
Could I copy over to other (Linux) machines and end up with the same wine program?
I hope to manage this without having to build wine from source again.
Now accidentally the source directory is removed, after I already run
sudo make install
.
Is there a way to 'reverse' the install, resulting in an archive or folder?Could I copy over to other (Linux) machines and end up with the same wine program?
I hope to manage this without having to build wine from source again.
hiddenhospitalresearch
(1 rep)
May 2, 2024, 12:14 PM
• Last activity: May 2, 2024, 04:12 PM
10
votes
4
answers
8926
views
Usage of Bang (!) in bash
I am reading the bash source code, and the [BNF grammar][1] for bash would be: ::= | '!' | | '!' | '!' ::= '|' | Does this means `!` command is a kind of pipe too. `! ls` works, however it's the same as `ls`. `! time ls` works too. That's quite different to `|` pipe. How to use `!` in bash? Is it a...
I am reading the bash source code, and the BNF grammar for bash would be:
::=
| '!'
|
| '!'
| '!'
::=
'|'
|
Does this means
!
command is a kind of pipe too.
! ls
works, however it's the same as ls
.
! time ls
works too.
That's quite different to |
pipe.
How to use !
in bash? Is it a pipe?
frams
(566 rep)
Nov 25, 2017, 01:39 PM
• Last activity: Mar 14, 2024, 04:07 PM
1
votes
1
answers
410
views
/var/lib/plocate/plocate.db: has version 4294967295, expected 0 or 1; please rebuild it
No matter how many times I rebuild the plocate db I get: ``` /var/lib/plocate/plocate.db: has version 4294967295, expected 0 or 1; please rebuild it. ``` How in the world did I manage this?? ``` /sbin/updatedb.plocate: linux-vdso.so.1 (0x0000007f1c7d4000) libzstd.so.1 => /lib/aarch64-linux-gnu/libzs...
No matter how many times I rebuild the plocate db I get:
/var/lib/plocate/plocate.db: has version 4294967295, expected 0 or 1; please rebuild it.
How in the world did I manage this??
/sbin/updatedb.plocate:
linux-vdso.so.1 (0x0000007f1c7d4000)
libzstd.so.1 => /lib/aarch64-linux-gnu/libzstd.so.1 (0x0000007f1c6c0000)
libstdc++.so.6 => /lib/aarch64-linux-gnu/libstdc++.so.6 (0x0000007f1c490000)
libm.so.6 => /lib/aarch64-linux-gnu/libm.so.6 (0x0000007f1c3f0000)
libgcc_s.so.1 => /lib/aarch64-linux-gnu/libgcc_s.so.1 (0x0000007f1c3c0000)
libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000007f1c210000)
/lib/ld-linux-aarch64.so.1 (0x0000003000000000)
/bin/plocate:
linux-vdso.so.1 (0x00000077e07be000)
liburing.so.2 => /lib/aarch64-linux-gnu/liburing.so.2 (0x00000077e0760000)
libzstd.so.1 => /lib/aarch64-linux-gnu/libzstd.so.1 (0x00000077e0690000)
libstdc++.so.6 => /lib/aarch64-linux-gnu/libstdc++.so.6 (0x00000077e0460000)
libgcc_s.so.1 => /lib/aarch64-linux-gnu/libgcc_s.so.1 (0x00000077e0430000)
libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x00000077e0280000)
/lib/ld-linux-aarch64.so.1 (0x0000003000000000)
libm.so.6 => /lib/aarch64-linux-gnu/libm.so.6 (0x00000077e01e0000)
plocate 1.1.15
Copyright 2020 Steinar H. Gunderson
License GPLv2+: GNU GPL version 2 or later .
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
updatedb (plocate) 1.1.15
Copyright (C) 2007 Red Hat, Inc. All rights reserved.
This software is distributed under the GPL v.2.
This program is provided with NO WARRANTY, to the extent permitted by law.
Fredrick Brennan
(121 rep)
Feb 24, 2023, 12:12 AM
• Last activity: Mar 2, 2024, 11:06 PM
2
votes
1
answers
3308
views
How to download a whole raspbian source code?
I'm new to linux and my teacher asked me to learn about how to build Raspbian from the source code. From what read in other questions, I need to download the Raspbian source code first. In some questions the link and appears to be the place where I can get the source code for the OS and kernel. The...
I'm new to linux and my teacher asked me to learn about how to build Raspbian from the source code.
From what read in other questions, I need to download the Raspbian source code first. In some questions the link and appears to be the place where I can get the source code for the OS and kernel.
The thing is, I'm not sure of what to download.
I need the source code of the Raspbian OS and then try to build it as is for academic reason. And I'm quite sure I was asked to compile Raspbian OS, not Raspbian Kernel. I finished compiling Raspbian Kernel yesterday and today I was asked to build Raspbian OS itself.
After I managed to build the OS, I am required to create a module to make Raspberry work with a certain sensor device (currently undecided).
PS: I think this is building a linux distro without added customisation. Is it right?
Widi Widiyanto
(135 rep)
Oct 10, 2016, 08:21 AM
• Last activity: Feb 20, 2024, 09:07 AM
0
votes
1
answers
214
views
Why does Bash behave differently when compiled from source code?
I ran git clone https://git.savannah.gnu.org/git/bash.git cd bash/ ./configure make ./bash I noticed that the newly launched Bash instance did not inherit the environment, specifically the PS1 variable that defines the shell prompt, from the parent shell. The inheritance works for `/bin/bash` [List...
I ran
git clone https://git.savannah.gnu.org/git/bash.git
cd bash/
./configure
make
./bash
I noticed that the newly launched Bash instance did not inherit the environment, specifically the PS1 variable that defines the shell prompt, from the parent shell.
The inheritance works for
/bin/bash
List of sourced files is the same for /bin/bash
and ./bash
./bash -lixc exit 2>&1 | sed -n 's/^+* \(source\|\.\) //p'
/bin/bash -lixc exit 2>&1 | sed -n 's/^+* \(source\|\.\) //p'
Edit:
As aviro mentiond PS1 was defined without export, so when I tried exporting it got inherited, so my initial question was wrong.
On my machine PS1 is defined in two files
/etc/bash/bashrc
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
[[ $DISPLAY ]] && shopt -s checkwinsize
PS1='[\u@\h \W]\$ '
And /etc/bash/bashrc.d/artix.bashrc
if ${use_color} ; then
if [[ ${EUID} == 0 ]] ; then
PS1='\[\033[01;31m\][\h\[\033[01;36m\] \W\[\033[01;31m\]]\$\[\033[00m\] '
else
PS1='\[\033[01;36m\][\u@\h\[\033[01;37m\] \W\[\033[01;36m\]]\$\[\033[00m\] '
fi
else
if [[ ${EUID} == 0 ]] ; then
# show root@ when we don't have colors
PS1='\u@\h \W \$ '
else
PS1='\u@\h \w \$ '
fi
fi
When I ran ./bash
the PS1 is \s-\v\$
and I have no idea why.
The command listing all sourced file shows that both of these files should be sourced when run with ./bash
, but for some reason they aren't or shell starts in different type/mode. Why?
Rustacean
(3 rep)
Sep 5, 2023, 02:33 PM
• Last activity: Sep 6, 2023, 10:24 PM
0
votes
1
answers
803
views
PHP was compiled with zlib module, but phpinfo() show it's disabled
In order to use Joomla! 4.3.1, I've compiled PHP 8.2 in an Oracle Linux 8.6 Server, with support for zlib compression: ``` # php --ri zlib zlib ZLib Support => enabled Stream Wrapper => compress.zlib:// Stream Filter => zlib.inflate, zlib.deflate Compiled Version => 1.2.11 Linked Version => 1.2.11 D...
In order to use Joomla! 4.3.1, I've compiled PHP 8.2 in an Oracle Linux 8.6 Server, with support for zlib compression:
Does someone have any hint on why PHP is having such behavior?
Note: I've compile with the following parameters:
# php --ri zlib
zlib
ZLib Support => enabled
Stream Wrapper => compress.zlib://
Stream Filter => zlib.inflate, zlib.deflate
Compiled Version => 1.2.11
Linked Version => 1.2.11
Directive => Local Value => Master Value
zlib.output_compression => On => On
zlib.output_compression_level => -1 => -1
zlib.output_handler => no value => no value
# php -m
[PHP Modules]
bcmath
bz2
(...)
zip
zlib
And I've enabled .output_compression = On
on /etc/php.ini
, which is the configuration file being used by PHP:
# php --ini
Configuration File (php.ini) Path: /etc
Loaded Configuration File: /etc/php.ini
Scan for additional .ini files in: /etc/php.d
Additional .ini files parsed: (none)
Nonetheway, ();
still shows that gzip compression is disabled:

./configure --prefix=/usr --disable-rpath --disable-debug --enable-calendar --enable-sysvshm --enable-bcmath --with-bz2 --enable-ctype --enable-exif --enable-ftp --with-gettext --enable-mbstring --enable-shmop --enable-sockets --with-zlib=/usr --without-pgsql --disable-static --with-layout=GNU --with-curl=/usr --with-mhash=/usr --with-unixODBC=/usr --with-snmp=shared --enable-soap --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --with-zip --with-pdo-mysql --with-mysqli --with-openssl --enable-fpm --with-kerberos --with-xsl --enable-opcache --enable-intl --with-pear --with-oci8=instantclient,/usr/lib/oracle/21/client64/lib --with-config-file-scan-dir=/etc/php.d
Thank you in advance.
Juliano B. Nequirito
(43 rep)
May 23, 2023, 08:04 PM
• Last activity: May 23, 2023, 09:15 PM
1
votes
0
answers
69
views
minimal instalation for X11R7.7
For the source code available here: https://www.x.org/releases/X11R7.7-RC1/src/, what are the minimal set I should install to get a working enviroment and be able to start it with the command startx?
For the source code available here: https://www.x.org/releases/X11R7.7-RC1/src/ , what are the minimal set I should install to get a working enviroment and be able to start it with the command startx?
Kleber Mota
(155 rep)
Apr 6, 2023, 01:13 AM
0
votes
1
answers
235
views
Install mmdebstrap from source
I am trying to install `mmdebstrap` from source. I cannot find any instructions online nor file any `Makefile`s and such in the [repo][1] [1]: https://gitlab.mister-muffin.de/josch/mmdebstrap
I am trying to install
mmdebstrap
from source. I cannot find any instructions online nor file any Makefile
s and such in the repo
sudoer
(65 rep)
Jan 11, 2023, 10:00 AM
• Last activity: Jan 11, 2023, 10:31 AM
0
votes
2
answers
382
views
Rely on the existence of a package manager or install package via downloading the source?
I'd like to create a script that is able to install my desired set of packages in any Linux distro (initially create it to run in Ubuntu and later expand it to whichever) and basically function as an environment setup. Examples of such packages would be *zsh, omz, fzf, autocomplete* etc... My questi...
I'd like to create a script that is able to install my desired set of packages in any Linux distro (initially create it to run in Ubuntu and later expand it to whichever) and basically function as an environment setup. Examples of such packages would be *zsh, omz, fzf, autocomplete* etc...
My question is this, should I rely on the existence of a package manager (
apt-get
) in order to install the package and just call that through the script or manually wget
the source files and proceed with the installation? Which do you think is best?
Invalid_Path
(111 rep)
Dec 15, 2022, 10:27 AM
• Last activity: Dec 15, 2022, 12:04 PM
7
votes
2
answers
4096
views
How can I get glibc/libstdc++ sources and set them up for gdb to find?
I'm debugging this program which raises an exception. This makes my debugger look for some source code, e.g. `../sysdeps/unix/sysv/linux/raise.c` - and fail to find it. Now, I realize it's not necessary for me to have these sources, but still - I would like them there. I'm working on a Devuan Chimae...
I'm debugging this program which raises an exception. This makes my debugger look for some source code, e.g.
../sysdeps/unix/sysv/linux/raise.c
- and fail to find it.
Now, I realize it's not necessary for me to have these sources, but still - I would like them there.
I'm working on a Devuan Chimaera GNU/Linux system.
What's the least-complicated way for me to have these sources available and locatable by gdb?
einpoklum
(10753 rep)
Nov 18, 2021, 09:10 PM
• Last activity: Nov 26, 2022, 07:45 PM
1
votes
1
answers
256
views
Why is "struct pid" member `numbers` defined as an array of size 1?
I noticed that, in `struct pid` in [pid.h](https://elixir.bootlin.com/linux/latest/source/include/linux/pid.h), the member `numbers` is defined as an array of size 1. ``` struct pid { refcount_t count; unsigned int level; spinlock_t lock; /* lists of tasks that use this pid */ struct...
I noticed that, in
struct pid
in
[pid.h](https://elixir.bootlin.com/linux/latest/source/include/linux/pid.h) ,
the member numbers
is defined as an array of size 1.
struct pid
{
refcount_t count;
unsigned int level;
spinlock_t lock;
/* lists of tasks that use this pid */
struct hlist_head tasks[PIDTYPE_MAX];
struct hlist_head inodes;
/* wait queue for pidfd notifications */
wait_queue_head_t wait_pidfd;
struct rcu_head rcu;
struct upid numbers;
};
However, in [pid.c](https://elixir.bootlin.com/linux/latest/source/kernel/pid.c#L244) , the member is accessed with indices other than 0.
pid->numbers[i].nr = nr;
How does this work without writing out of bounds?
Tomek Dobrzynski
(117 rep)
Oct 6, 2022, 06:51 PM
• Last activity: Oct 7, 2022, 12:24 PM
2
votes
1
answers
21031
views
git clone from https URL fails, says it's 'remote-https' is not a git command and that templates werent' found
I'm working on a CentOS 7.9 GNU/Linux system. I've built and installed a newer version of git (2.34.1 instead of 1.8.3.1 that's bundled with the distribution) under `/opt/git/2.34.1`, with a symlink to that directory at `/opt/git/current`; and I've added that symlinked directory to (the beginning of...
I'm working on a CentOS 7.9 GNU/Linux system. I've built and installed a newer version of git (2.34.1 instead of 1.8.3.1 that's bundled with the distribution) under
/opt/git/2.34.1
, with a symlink to that directory at /opt/git/current
; and I've added that symlinked directory to (the beginning of) my $PATH
variable.
Unfortunately, when I try the checkout a repository with an HTTPS URL, I get a few errors
$ git clone https://github.com/eyalroz/cuda-api-wrappers.git
Cloning into 'cuda-api-wrappers'...
git: 'remote-https' is not a git command. See 'git --help'.
cloning with the _old_ version of git - works.
Why does this happen, and what can I do to resolve it?
einpoklum
(10753 rep)
Mar 15, 2022, 02:13 PM
• Last activity: Jun 22, 2022, 10:03 AM
1
votes
1
answers
770
views
Where can I get the current source code for SUSE SLES products?
I'm having a critical support issue with SLES that doesn't make any measurable progress (for months now). So I wanted to have a look at the source code myself; maybe I can spot the issue. (It seems a fatal bug was added between SLES15 SP2 and SP3 in the Xen Hypervisor that causes frequent server cra...
I'm having a critical support issue with SLES that doesn't make any measurable progress (for months now).
So I wanted to have a look at the source code myself; maybe I can spot the issue.
(It seems a fatal bug was added between SLES15 SP2 and SP3 in the Xen Hypervisor that causes frequent server crashes due to RAM corruption)
As I see it you can download DVD images that should contain the source code, but those are as old as the media are.
Meaning: You don't have the source for the current patches.
Isn't there a public Git repository where I could inspect the changes being made from release to release or from patch to patch?
I don't want to download ISO images, unpack them, download more RPM source packages and unpack them, etc. just to see the changes.
I see that the business model is somewhat against that, but from a support perspective that is vital.
U. Windl
(1715 rep)
May 3, 2022, 08:35 AM
• Last activity: May 4, 2022, 03:57 PM
0
votes
1
answers
79
views
I am searching for the source code to libj2d-gtk-linux-i386-2.0.0.so
I am looking for the source code to *libj2d-gtk-linux-i386-2.0.0.so* which is reported to be contained in a file named *GtkGraphics2DFactory.c*. This library is an SWT 2 Java bit of glue that is found in Jaspersoft Studio CE. The library itself I can find. I need the source to determine if it is pos...
I am looking for the source code to *libj2d-gtk-linux-i386-2.0.0.so* which is reported to be contained in a file named *GtkGraphics2DFactory.c*. This library is an SWT 2 Java bit of glue that is found in Jaspersoft Studio CE. The library itself I can find. I need the source to determine if it is possible to port Studio to FreeBSD.
James B. Byrne
(125 rep)
Dec 2, 2020, 05:16 PM
• Last activity: May 3, 2022, 09:02 AM
21
votes
3
answers
159925
views
convert executable back to C source code
Unfortunately I lost my source code and I just have the output file that made with gcc in linux and I don’t have any access to my pc now.is there any way to convert output file to source file (in c under linux)?
Unfortunately I lost my source code and I just have the output file that made with gcc in linux and I don’t have any access to my pc now.is there any way to convert output file to source file (in c under linux)?
mahsa
(211 rep)
Sep 15, 2015, 12:11 PM
• Last activity: Apr 18, 2022, 10:38 AM
40
votes
11
answers
38546
views
Counting lines of code?
if I want to count the lines of code, the trivial thing is `cat *.c *.h | wc -l` But what if I have several subdirectories?
if I want to count the lines of code, the trivial thing is
cat *.c *.h | wc -l
But what if I have several subdirectories?
Niklas Rosencrantz
(4324 rep)
Jun 8, 2016, 11:28 AM
• Last activity: Dec 19, 2021, 07:05 PM
0
votes
1
answers
484
views
How would I go about compiling GNUzilla/Icecat from source in support for my specific ARM CPU?
I recently picked up the Pine H64 which has the *Allwinner “H6” Quad-Core ARM Cortex A53 64-Bit Processor.* How would I go about compiling Icecat in support for this on Manjaro ARM?
I recently picked up the Pine H64 which has the *Allwinner “H6” Quad-Core ARM Cortex A53 64-Bit Processor.* How would I go about compiling Icecat in support for this on Manjaro ARM?
Arm User
(1 rep)
Aug 4, 2021, 08:28 PM
• Last activity: Aug 4, 2021, 09:21 PM
9
votes
5
answers
42377
views
How to get all paths from a website using cURL
`curl //website//` will get me the source code but from there how would I filter our every unique path and obtain the number of them? the question: > Use cURL from your machine to obtain the source code of the "https://www.inlanefreight.com" website and filter all unique paths of that domain. Submit...
curl //website//
will get me the source code but from there how would I filter our every unique path and obtain the number of them?
the question:
> Use cURL from your machine to obtain the source code of the "https://www.inlanefreight.com " website and filter all unique paths of that domain. Submit the number of these paths as the answer.
from the question, I do not know the meaning of "UNIQUE PATHS", but I think it means something similar to what you get from executing
$wget -p
-----------------------------------------
I used this method and it worked somehow
wget --spider --recursive https://www.inlanefreight.com
this will show
Found 10 broken links.
https://www.inlanefreight.com/wp-content/themes/ben_theme/fonts/glyphicons-halflings-regular.eot
https://www.inlanefreight.com/wp-content/themes/ben_theme/fonts/glyphicons-halflings-regular.woff
https://www.inlanefreight.com/wp-content/themes/ben_theme/fonts/glyphicons-halflings-regular.woff2
https://www.inlanefreight.com/wp-content/themes/ben_theme/fonts/glyphicons-halflings-regular.eot ?
https://www.inlanefreight.com/wp-content/themes/ben_theme/fonts/glyphicons-halflings-regular.ttf
FINISHED --2020-12-06 05:34:58--
Total wall clock time: 2.5s
Downloaded: 23 files, 794K in 0.1s (5.36 MB/s)
at the bottom.
assuming 23 downloads and 10 broken links all add up to be the unique path I got 33 and it was the correct answer.
YnSkn
(353 rep)
Dec 6, 2020, 01:58 AM
• Last activity: Jul 29, 2021, 01:11 PM
Showing page 1 of 20 total questions