Imbricated var on tmux - tmux

I want to use something like :
is_active_window="#{==:#{active_window_index},#{window_index}}"
active_i="#[fg=$thm_bg,bg=$thm_orange] #I "
inactive_i="#[fg=$thm_bg,bg=$thm_blue] #I "
styled_i="#{?${is_active_window},${active_i},${inactive_i}}"
But when I do (for example) :
setw -g window-status-format "${styled_i}"
setw -g window-status-current-format "${styled_i}"
I got this :
It is possible to do this kind of stuff (the styled_i variable) in tmux or not ? If yes how ?

Related

__e_acsl_assert is not getting added for all given assert in .i file

I am new to Frama-C. I specifically need to use e-acsl plugin for verification purposes. I used first.i file as
int main(void) {
int x = 0;
/∗# assert x == 0; ∗/
/∗# assert x == 1; ∗/
return 0;
}
Created monitored_first.c file from first.i file using the following command.
$ frama-c -e-acsl first.i -then-last -print -ocode monitored_first.c
The main function inside the monitored_first.c looks like the one below.
int main(void)
{
int __retres;
__e_acsl_memory_init((int *)0,(char ***)0,8UL);
int x = 0;
__retres = 0;
__e_acsl_memory_clean();
return __retres;
}
It is not adding e_acsl assertion for x==1.
I tried it using the "e-acsl-gcc.sh" script , which generated the monitored_first.i file. But the main function inside monitored_first.i is same as that in monitored_first.c.
$ e-acsl-gcc.sh -c -omonitored_first.i first.i
The above command generated two executable, "a.out.e-acsl" and "a.out". It also generates some warnings when run in ubuntu 22.04 as follows:
/home/amrutha/.opam/4.11.1/bin/frama-c -remove-unused-specified-functions -machdep gcc_x86_64 '-cpp-extra-args= -std=c99 -D_DEFAULT_SOURCE -D__NO_CTYPE -D__FC_MACHDEP_X86_64 ' -no-frama-c-stdlib first.i -e-acsl -e-acsl-share=/home/amrutha/.opam/4.11.1/bin/../share/frama-c/e-acsl -then-last -print -ocode monitored_first.i
[kernel] Parsing first.i (no preprocessing)
[e-acsl] beginning translation.
[kernel] Parsing FRAMAC_SHARE/e-acsl/e_acsl.h (with preprocessing)
/tmp/ppannot15ad34.c:362: warning: "__STDC_IEC_60559_BFP__" redefined
362 | #define __STDC_IEC_60559_BFP__ 201404L
|
In file included from <command-line>:
/usr/include/stdc-predef.h:39: note: this is the location of the previous definition
39 | # define __STDC_IEC_60559_BFP__ 201404L
|
/tmp/ppannot15ad34.c:363: warning: "__STDC_IEC_60559_COMPLEX__" redefined
363 | #define __STDC_IEC_60559_COMPLEX__ 201404L
|
In file included from <command-line>:
/usr/include/stdc-predef.h:49: note: this is the location of the previous definition
49 | # define __STDC_IEC_60559_COMPLEX__ 201404L
|
[e-acsl] translation done in project "e-acsl".
+ gcc -std=c99 -m64 -g -O2 -fno-builtin -fno-merge-constants -Wall -Wno-long-long -Wno-attributes -Wno-nonnull -Wno-undef -Wno-unused -Wno-unused-function -Wno-unused-result -Wno-unused-value -Wno-unused-function -Wno-unused-variable -Wno-unused-but-set-variable -Wno-implicit-function-declaration -Wno-empty-body first.i -o a.out
+ gcc -DE_ACSL_SEGMENT_MMODEL -std=c99 -m64 -g -O2 -fno-builtin -fno-merge-constants -Wall -Wno-long-long -Wno-attributes -Wno-nonnull -Wno-undef -Wno-unused -Wno-unused-function -Wno-unused-result -Wno-unused-value -Wno-unused-function -Wno-unused-variable -Wno-unused-but-set-variable -Wno-implicit-function-declaration -Wno-empty-body -I/home/amrutha/.opam/4.11.1/bin/../share/frama-c/e-acsl -o a.out.e-acsl monitored_first.i /home/amrutha/.opam/4.11.1/bin/../share/frama-c/e-acsl/e_acsl_rtl.c /home/amrutha/.opam/4.11.1/bin/../lib/frama-c/e-acsl/libeacsl-dlmalloc.a -lgmp -lm
In ubuntu 20.04 there is no any warning, only the end part is getting displayed. When run ./a.out.e-acsl , it simply run the code without any message, which is not supposed. The expected output should look like this:
$ ./a.out.e-acsl
first.i: In function 'main'
first.i:4: Error: Assertion failed:
The failing predicate is:
x == 1.
Aborted (core dumped)
$ echo $?
134
I tried it in ubuntu 22.04 with opam version 2.1.2 and Fragma-C 25.0
and ubuntu 20.04 with opam version 2.0.5 and Fragma-C 25.0
The same issue has been posted to Frama-C's public bug tracking and it seems the cause might have been the non-ASCII asterisk characters used in the ACSL annotations: ∗ instead of *.
I still don't understand how the comments could parse at all (my compiler gives a syntax error), but the user seems to indicate that replacing them solved the problem.
In any case, in similar situations one can either use the Frama-C GUI to open the parsed file and check if Frama-C recognizes the ACSL annotations (they should show up in the CIL normalized code), or try other analyses, e.g. running frama-c -eva and checking that it detects the annotations.

Tmux not recognizing Meta key mapping

I am using neovim and tmux (with tmuxinator) with the ultimate goal of getting https://github.com/christoomey/vim-tmux-navigator setup on my M1 Macbook with iTerm2 or Warp (https://www.warp.dev/)
I have mapped my left option key to be my meta key in my terminal. I would like to use <M-h/j/k/l> in order to navigate between neovim splits and tmux panes. Mapping my left option key to meta and using it with h/j/k/l works as expected in neovim (including neovim in tmux - i.e. i can navigate neovim splits and go from neovim to a tmux terminal pane). However, in a tmux terminal pane it either does nothing in iTerm2 or brings up alternate text (˙∆˚¬ for hjkl to be specific) in Warp.
Below are my configurations which were from https://github.com/christoomey/vim-tmux-navigator and i just updated them to use meta instead of ctrl:
init.vim
let g:tmux_navigator_no_mappings = 1
nnoremap <silent> <M-h> :TmuxNavigateLeft<cr>
nnoremap <silent> <M-j> :TmuxNavigateDown<cr>
nnoremap <silent> <M-k> :TmuxNavigateUp<cr>
nnoremap <silent> <M-l> :TmuxNavigateRight<cr>
nnoremap <silent> <M-\> :TmuxNavigatePrevious<cr>
.tmux.conf
unbind M-h
unbind M-j
unbind M-k
unbind M-l
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n 'M-h' if-shell "$is_vim" 'send-keys M-h' 'select-pane -L'
bind-key -n 'M-j' if-shell "$is_vim" 'send-keys M-j' 'select-pane -D'
bind-key -n 'M-k' if-shell "$is_vim" 'send-keys M-k' 'select-pane -U'
bind-key -n 'M-l' if-shell "$is_vim" 'send-keys M-l' 'select-pane -R'
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
"bind-key -n 'M-\\' if-shell \"$is_vim\" 'send-keys M-\\' 'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
"bind-key -n 'M-\\' if-shell \"$is_vim\" 'send-keys M-\\\\' 'select-pane -l'"
bind-key -T copy-mode-vi 'M-h' select-pane -L
bind-key -T copy-mode-vi 'M-j' select-pane -D
bind-key -T copy-mode-vi 'M-k' select-pane -U
bind-key -T copy-mode-vi 'M-l' select-pane -R
bind-key -T copy-mode-vi 'M-\' select-pane -l
How can i get this to work? I would be happy to get it working on either terminal.

Tmux - Creating new sessions display some list of errors

How can i fix this anyone please?
When i create a new session tmux new -s sample_session The list of errors always appeared.
home/glennfield/.tmux.conf:3: unknown command: bell-action
/home/glennfield/.tmux.conf:4: unknown command: bell-on-alert
/home/glennfield/.tmux.conf:5: unknown command: default-command
/home/glennfield/.tmux.conf:6: unknown command: default-shell
/home/glennfield/.tmux.conf:7: unknown command: default-terminal
/home/glennfield/.tmux.conf:8: unknown command: destroy-unattached
/home/glennfield/.tmux.conf:9: unknown command: detach-on-destroy
/home/glennfield/.tmux.conf:10: unknown command: display-panes-active-- colour
Here's my tmux.conf
assume-paste-time 1
base-index 0
bell-action any
bell-on-alert off
default-command ""
default-shell "/bin/bash"
default-terminal "screen"
destroy-unattached off
detach-on-destroy on
display-panes-active-colour red
display-panes-colour blue
display-panes-time 1000
display-time 750
history-limit 2000
lock-after-time 0
lock-command "lock -np"
lock-server on
message-command-style fg=yellow,bg=black
message-style fg=black,bg=yellow
mouse-resize-pane off
mouse-select-pane off
mouse-select-window off
mouse-utf8 on
prefix C-b
prefix2 none
renumber-windows off
repeat-time 500
set-remain-on-exit off
set-titles off
set-titles-string "#S:#I:#W - "#T""
status on
status-interval 15
status-justify left
status-keys vi
status-left "[#S] "
status-left-length 10
status-left-style default
status-position bottom
status-right " "#{=21:pane_title}" %H:%M %d-%b-%y"
status-right-length 40
status-right-style default
status-style fg=black,bg=green
status-utf8 on
update-environment "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID
SSH_CONNECTION WINDOWID XAUTHORITY"
visual-activity off
visual-bell off
visual-silence off
word-separators " -_#"
You need to fix your tmux.conf
The commands you use don't exist or are uncomplete
Ex : you should use display-panes-colour instead display-panes-active-- colour
full command should be something like :
set-option -g display-panes-active-colour colour33

How to search patterns in a single line from a file in unix

Suppose I have file with a single line.
/a/n/v//9.3/b/ld --verbose -o o/c/f/r1 -r o/c/f/fn.o o/c/f/fyt.o L/fs/ed/pl/tls/oe -L/apps/ose/5.5.3//lib/powerpc -lc -lrt -lm -lcp -lel -lip -lubs -lpp -lpc /a/oe/5.3//g3/l/g.3/nf/libgcov.a -lrds -l00_ex -lmcu /a/n/v//9.3/b/ld --verbose -o o/ce/wef/r34
I want to search for the pattern starting with "-l" and arrange it in the below order in another file.
-lc
-lrt
-lm
-lcp
-lel
-lip
-lubs
-lpp
-lpc
-lrds
-l00_ex
-lmcu
What command could be used to search the pattern mentioned above?
Here you go:
echo "/a/n/v//9.3/b/ld --verbose -o o/c/f/r1 -r o/c/f/fn.o o/c/f/fyt.o L/fs/ed/pl/tls/oe -L/apps/ose/5.5.3//lib/powerpc -lc -lrt -lm -lcp -lel -lip -lubs -lpp -lpc /a/oe/5.3//g3/l/g.3/nf/libgcov.a -lrds -l00_ex -lmcu /a/n/v//9.3/b/ld --verbose -o o/ce/wef/r34" \
| awk '{for (i=1;i<=NF;i++) {if ($i ~ /^-l/) print $i }}' | sort
output
-l00_ex
-lc
-lcp
-lel
-lip
-lm
-lmcu
-lpc
-lpp
-lrds
-lrt
-lubs
Needless to say, if you don't want the output sorted for some reason, just remove |sort on the end. It will then print the arguments in the order listed on the cmd-line. (I suppose sometimes that would be important).
I'm using a standard awk idom, of iterating per element over the provided input
for (i=1;i<=NF;i++)
the i is a tmp variable, NF means N umber (of) F ields, meaning the num-of-fields in the current line. The test is done with regular expression test
if ($i ~ /^-l/ )
where $i is the value of the i'th position in the input, and ^ indicates "must be at the front of the string", while -l matches any of the inputs you have provided.
echoing your data to awk via a pipe shows that awk is very comfortable reading from std-in, so you can replace echo with grep yourSearchtarget yourFile | awk ... or any other command that will return the lines you need for processing.
IHTH

Make error when trying to build QT app for an "Open Embedded2 device

I am getting this error when trying to build my app:
make: Wl,-rpath-link,: Command not found
My Makefile looks like this, which is a generated file useing qmake program in the OE toolchain.
#############################################################################
# Makefile for building: app_qt
# Generated by qmake (2.01a) (Qt 4.8.1) on: Tue Jun 26 17:49:26 2012
# Project: app_qt.pro
# Template: app
# Command: /usr/local/oecore-i686/sysroots/i686-oesdk-linux/usr/bin/qmake -o Makefile ap_qt.pro
#############################################################################
####### Compiler, tools and options
CC = $(OE_QMAKE_CC)
CXX = $(OE_QMAKE_CXX)
DEFINES = -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB
CFLAGS = -pipe -pipe $(OE_QMAKE_CFLAGS) -fpermissive -O2 -Wall -W -Wall -W -D_REENTRANT $(DEFINES)
CXXFLAGS = -pipe -pipe -pipe $(OE_QMAKE_CFLAGS) $(OE_QMAKE_CXXFLAGS) -O2 -O2 -Wall -W -Wall -W -Wall -W -D_REENTRANT $(DEFINES)
INCPATH = -I/usr/local/oecore-i686/sysroots/armv7ahf-vfp-neon-oe-linux-gnueabi/usr/share/qtopia/mkspecs/linux-g++ -I. -I$(OE_QMAKE_INCDIR_QT)/QtCore -I$(OE_QMAKE_INCDIR_QT)/QtGui -I$(OE_QMAKE_INCDIR_QT) -I. -Isrc -Isrc/screens -Isrc/Lists -Isrc/widgets -Isrc/FileIO -Isrc/communication -IQSerialDevice/src -I.
LINK = $(OE_QMAKE_LINK)
LFLAGS = $(OE_QMAKE_LDFLAGS) -Wl,-rpath-link,$(OE_QMAKE_LIBDIR_QT)
LIBS = $(SUBLIBS) -L$(OE_QMAKE_LIBDIR_QT) -lQtGuiE -lQtCoreE -lpthread
AR = $(OE_QMAKE_AR) cqs
RANLIB =
QMAKE = /usr/local/oecore-i686/sysroots/i686-oesdk-linux/usr/bin/qmake
TAR = tar -cf
COMPRESS = gzip -9f
COPY = cp -f
SED = sed
COPY_FILE = $(COPY)
COPY_DIR = $(COPY) -r
STRIP = $(OE_QMAKE_STRIP)
INSTALL_FILE = install -m 644 -p
INSTALL_DIR = $(COPY_DIR)
INSTALL_PROGRAM = install -m 755 -p
DEL_FILE = rm -f
SYMLINK = ln -f -s
DEL_DIR = rmdir
MOVE = mv -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
####### Output directory
OBJECTS_DIR = ./
Does anybody recognize the error and know why it emerges?
Thanks in advance. :)
The error is generated because the variable $(OE_QMAKE_LIBDIR_QT) doesn't exist. So
-Wl,-rpath-link,$(OE_QMAKE_LIBDIR_QT)
becomes
-Wl,-rpath-link,
Are you setting the other variables like $(OE_QMAKE_CC) and $(OE_QMAKE_CXX), and if so, where? You should add the variable above to this list. It should point to the lib subdir of your Qt installation.
This could be for example (here it's Qt version 4.8.0): /usr/local/Trolltech/Qt-4.8.0/lib.
In a local installation in your home directory, it may look like this: ~/qt/Desktop/Qt/4.8.1/gcc/lib.
For Qtopia, you should look in /usr/local/oecore-i686/sysroots...

Resources