#!/usr/bin/python # SPDX-License-Identifier: GPL-2.0 # # diffconfig - a tool to compare .config files. # # originally written in 2006 by Matt Mackall # (at least, this was in his bloatwatch source code) # last worked on 2008 by Tim Bird # import sys, os def usage(): print("""Usage: diffconfig [-h] [-m] [ ] Diffconfig is a simple utility for comparing two .config files. Using standard diff to compare .config files often includes extraneous and distracting information. This utility produces sorted output with only the changes in configuration values between the two files. Added and removed items are shown with a leading plus or minus, respectively. Changed items show the old and new values on a single line. If -m is specified, then output will be in "merge" style, which has the changed and new values in kernel config option format. If no config files are specified, .config and .config.old are used. Example usage: $ diffconfig .config config-with-some-changes -EXT2_FS_XATTR n CRAMFS n -> y EXT2_FS y -> n LOG_BUF_SHIFT 14 -> 16 PRINTK_TIME n -> y """) sys.exit(0) # returns a dictionary of name/value pairs for config items in the file def readconfig(config_file): d = {} for line in config_file: line = line[:-1] if line[:7] == "CONFIG_": name, val = line[7:].split("=", 1) d[name] = val if line[-11:] == " is not set": d[line[9:-11]] = "n" return d def print_config(op, config, value, new_value): global merge_style if merge_style: if new_value: if new_value=="n": print("# CONFIG_%s is not set" % config) else: print("CONFIG_%s=%s" % (config, new_value)) else: if op=="-": print("-%s %s" % (config, value)) elif op=="+": print("+%s %s" % (config, new_value)) else: print(" %s %s -> %s" % (config, value, new_value)) def main(): global merge_style # parse command line args if ("-h" in sys.argv or "--help" in sys.argv): usage() merge_style = 0 if "-m" in sys.argv: merge_style = 1 sys.argv.remove("-m") argc = len(sys.argv) if not (argc==1 or argc == 3): print("Error: incorrect number of arguments or unrecognized option") usage() if argc == 1: # if no filenames given, assume .config and .config.old build_dir="" if "KBUILD_OUTPUT" in os.environ: build_dir = os.environ["KBUILD_OUTPUT"]+"/" configa_filename = build_dir + ".config.old" configb_filename = build_dir + ".config" else: configa_filename = sys.argv[1] configb_filename = sys.argv[2] try: a = readconfig(open(configa_filename)) b = readconfig(open(configb_filename)) except (IOError): e = sys.exc_info()[1] print("I/O error[%s]: %s\n" % (e.args[0],e.args[1])) usage() # print items in a but not b (accumulate, sort and print) old = [] for config in a: if config not in b: old.append(config) old.sort() for config in old: print_config("-", config, a[config], None) del a[config] # print items that changed (accumulate, sort, and print) changed = [] for config in a: if a[config] != b[config]: changed.append(config) else: del b[config] changed.sort() for config in changed: print_config("->", config, a[config], b[config]) del b[config] # now print items in b but not in a # (items from b that were in a were removed above) new = sorted(b.keys()) for config in new: print_config("+", config, None, b[config]) main() 4.y Hosts the 0x221E linux distro kernel.Ubuntu
summaryrefslogtreecommitdiff
AgeCommit message (Expand)Author
2025-03-28proc: fix UAF in proc_get_inode()Ye Bin
2024-02-25procfs: make freeing proc_fs_info rcu-delayedAl Viro
2023-08-02x86: Expose thread features in /proc/$PID/statusRick Edgecombe
2023-05-17procfs: consolidate arch_report_meminfo declarationArnd Bergmann
2022-11-08net, proc: Provide PROC_FS=n fallback for proc_create_net_single_write()David Howells
2022-01-22proc: remove PDE_DATA() completelyMuchun Song
2022-01-22fs: proc: store PDE()->data into inode->i_privateMuchun Song
2022-01-20proc: make the proc_create[_data]() stubs static inlinesHans de Goede
2021-05-06proc: mandate ->proc_lseek in "struct proc_ops"Alexey Dobriyan
2020-12-15proc: fix lookup in /proc/net subdirectories after setns(2)Alexey Dobriyan
2020-09-03proc: add a read_iter method to proc proc_opsChristoph Hellwig
2020-07-25bpf: Refactor to provide aux info to bpf_iter_init_seq_priv_tYonghong Song
2020-06-04Merge branch 'proc-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/eb...Linus Torvalds
2020-06-03Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-nextLinus Torvalds
2020-05-19proc: proc_pid_ns takes super_block as an argumentAlexey Gladkov
2020-05-13nsproxy: attach to namespaces via pidfdsChristian Brauner
2020-05-09net: bpf: Add netlink and ipv6_route bpf_iter targetsYonghong Song
2020-04-22proc: use named enums for better readabilityAlexey Gladkov
2020-04-22proc: add option to mount only a pids subsetAlexey Gladkov
2020-04-22proc: instantiate only pids that we can ptrace on 'hidepid=4' mount optionAlexey Gladkov
2020-04-22proc: allow to mount many instances of proc in one pid namespaceAlexey Gladkov
2020-04-07proc: faster open/read/close with "permanent" filesAlexey Dobriyan
2020-02-24proc: Use a list of inodes to flush from procEric W. Biederman
2020-02-04proc: decouple proc from VFS with "struct proc_ops"Alexey Dobriyan
2019-12-04include/linux/proc_fs.h: fix confusing macro arg nameMiaohe Lin
2019-06-12proc: Add /proc/<pid>/arch_statusAubrey Li
2019-03-05signal: add pidfd_send_signal() syscallChristian Brauner
2018-08-22proc: spread "const" a bitAlexey Dobriyan
2018-05-18proc: Add a way to make network proc files writableDavid Howells
2018-05-16proc: introduce proc_create_net_singleChristoph Hellwig
2018-05-16proc: introduce proc_create_net{,_data}Christoph Hellwig
2018-05-16proc: introduce proc_create_single{,_data}Christoph Hellwig
2018-05-16proc: introduce proc_create_seq_privateChristoph Hellwig
2018-05-16proc: introduce proc_create_seq{,_data}Christoph Hellwig
2018-05-16proc: introduce a proc_pid_ns helperChristoph Hellwig
2017-11-02License cleanup: add SPDX GPL-2.0 license identifier to files with no licenseGreg Kroah-Hartman
2017-09-08proc: uninline proc_create()Alexey Dobriyan
2016-12-13Merge tag 'for-linus-4.10-rc0-tag' of git://git.kernel.org/pub/scm/linux/kern...Linus Torvalds
2016-11-17xenfs: Use proc_create_mount_point() to create /proc/xenSeth Forshee
2016-10-31net: add an ioctl to get a socket network namespaceAndrey Vagin