Skip to content

Instantly share code, notes, and snippets.

View legionus's full-sized avatar

Alexey Gladkov legionus

  • Brno, Czech Republic
View GitHub Profile
#!/usr/bin/env python3
import ply.lex as lex
import ply.yacc as yacc
import logging
import pprint
logging.basicConfig(
def process_commands(payload):
fd = io.StringIO(initial_value=payload, newline='\n')
while True:
value = fd.readline()
if not value:
break
value = value[:-1]
#!/bin/bash -efu
# SPDX-License-Identifier: GPL-2.0-or-later
. shell-error
declare -A VARS=() LOCK=() GOTO=() LABEL=()
declare -A NAMES=( [KEY]=0 [ATTR]=1 [OPERATOR]=2 [VALUE]=3 )
declare -a RULE_FILES=()
rule_init_var()
  • Руками(?) в пакетах мы переносим всё из /bin, /sbin в соответстующие /usr/bin и /usr/sbin и создаём Provides со старым путём.
  • rpm должен сам создавать симлинк. Если есть Provides /bin/sh и файл /usr/bin/sh, то создаём ссылку /bin/sh -> ../usr/bin/sh.
  • После того как в /bin не останется ничего кроме ссылок на /usr/bin, в пакете filesystem можно менять /bin на симлинк.
  • Пока пакет filesystem не обновился, мы находимся на стадии постепенной подготовки, замещая файлы в /bin автоматическими ссылкам.
  • Чтобы filesystem заменить каталог на ссылку нам нужно удалить каталог в %pretrans. В этом случае конфликта не должно быть. From rpm handleRemovalConflict():
...but if the conflicting item is either not on disk, or has
already been changed to the new type, we should be ok afterall.
AAA_BBB = 123
BBB-CCC = 456
AAA1 = `echo $HOME`
_upper_ = A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
_lower_ = a b c d e f g h i j k l m n o p q r s t u v w x y z
_digits_ = 0 1 2 3 4 5 6 7 8 9
define remove-recursive
$(if $(1),$(call remove-recursive,$(wordlist 2,$(words $(1)),$(1)),$(subst $(firstword $(1)),,$(2))),$(2))
#!/bin/bash -eu
case "${1:-0}" in
0)
i=1
while :; do
echo TRY $i
i=$(($i+1))
mkdir /tmp/lock
#!/bin/bash -efu
. shell-error
. shell-temp
get_apt_config()
{
local get_eval get_name get_value
get_name="$1"
shift || return 1
$ semind search -f '%m %f:%l %C \t%s' user_namespace.uid_map
def include/linux/user_namespace.h:61 struct uid_gid_map uid_map;
-w- kernel/user.c:28 init_user_ns .uid_map = {
-r- kernel/user_namespace.c:187 free_user_ns if (ns->uid_map.nr_extents > UID_GID_MAP_MAX_BASE_EXTENTS) {
-r- kernel/user_namespace.c:188 free_user_ns kfree(ns->uid_map.forward);
-r- kernel/user_namespace.c:189 free_user_ns kfree(ns->uid_map.reverse);
m-- kernel/user_namespace.c:390 make_kuid return KUIDT_INIT(map_id_down(&ns->uid_map, uid));
m-- kernel/user_namespace.c:409 from_kuid return map_id_up(&targ->uid_map, __kuid_val(kuid));
m-- kernel/user_namespace.c:661 uid_m_start return m_start(seq, ppos, &ns->uid_map);
m-- kernel/user_namespace.c:1101 proc_uid_map_write &ns->uid_map, &ns->parent->uid_map);
@legionus
legionus / hack.sh
Last active February 8, 2021 12:41
#!/bin/sh -efu
. shell-error
SYSFS_PATH="/sys"
BASE_DIR="/"
KERNEL_SRC_DIR=/home/legion/scm/kernel/linux-release
find_modules()
{
#include <sys/uio.h>
#include <unistd.h>
#include <limits.h>
#include <stdio.h>
#include <string.h>
#include <error.h>
enum record_fields_type {
RECORD_FIELD_TIME = 0,