Created attachment 513698 [details, diff] [PATCH] read_repos_conf: reject ~ postfixed files (aka backup files) Hello, I see that when executing `q -r` to update the cache, all files found in the directory specified by the variable repos_conf (main.c:487 i.e. /etc/portage/repos.conf as of commit b7edba4e6c51901f40aefca78be5095e9dd434a4) are processed to retrieve information about the repos (i.e. location), except the files whose name begins with a '.' dot. In my humble opinion, files postfixed with a '~' tilde should also be excluded from processing, since they are obviously backup file -- Emacs is known to create such backup files after editing a file. Here I propose a patch (which I also "pull requested" on github.com) to change the behaviour of `q` and exclude backup files found in repos_conf from processing (aka files postfixed with ~). Please, let me know if my suggestion is appropriate. Thanks.
# emerge --info =app-portage/portage-utils-0.64 Portage 2.3.13 (python 2.7.14-final-0, default/linux/amd64/17.0, gcc-6.4.0, glibc-2.25-r9, 4.14.8-gentoo-r1-custom x86_64) ================================================================= System Settings ================================================================= System uname: Linux-4.14.8-gentoo-r1-custom-x86_64-Intel-R-_Core-TM-2_Duo_CPU_T9900_@_3.06GHz-with-gentoo-2.4.1 KiB Mem: 8147412 total, 1903376 free KiB Swap: 10485756 total, 10485756 free Timestamp of repository gentoo: Sun, 07 Jan 2018 02:15:01 +0000 Head commit of repository gentoo: 8e08e84712565beacae1de58acb7fb944756fb14 sh bash 4.4_p12 ld GNU ld (Gentoo 2.29.1 p3) 2.29.1 distcc 3.2rc1 x86_64-pc-linux-gnu [disabled] app-shells/bash: 4.4_p12::gentoo dev-lang/perl: 5.24.3::gentoo dev-lang/python: 2.7.14-r1::gentoo, 3.4.5-r1::gentoo, 3.5.4-r1::gentoo, 3.6.3-r1::gentoo dev-util/cmake: 3.9.6::gentoo dev-util/pkgconfig: 0.29.2::gentoo sys-apps/baselayout: 2.4.1-r2::gentoo sys-apps/openrc: 0.34.11::gentoo sys-apps/sandbox: 2.10-r4::gentoo sys-devel/autoconf: 2.13::gentoo, 2.69-r4::gentoo sys-devel/automake: 1.15.1-r1::gentoo sys-devel/binutils: 2.29.1-r1::gentoo sys-devel/gcc: 4.9.4::gentoo, 6.4.0::gentoo sys-devel/gcc-config: 1.8-r1::gentoo sys-devel/libtool: 2.4.6-r3::gentoo sys-devel/make: 4.2.1::gentoo sys-kernel/linux-headers: 4.13::gentoo (virtual/os-headers) sys-libs/glibc: 2.25-r9::gentoo Repositories: gentoo location: /emerge/portage sync-type: rsync sync-uri: rsync://rsync.at.gentoo.org/gentoo-portage priority: -1000 sync-rsync-extra-opts: crossdev location: /usr/local/portage masters: gentoo pentoo palemoon priority: 0 imaging location: /var/lib/layman/imaging masters: gentoo priority: 50 palemoon location: /var/lib/layman/palemoon masters: gentoo priority: 50 pentoo location: /var/lib/layman/pentoo masters: gentoo priority: 50 posativ location: /var/lib/layman/posativ masters: gentoo priority: 50 ACCEPT_KEYWORDS="amd64" ACCEPT_LICENSE="@FREE" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-O2 -pipe" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt /var/lib/i2pd/certificates" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c" CXXFLAGS="-O2 -pipe" DISTDIR="/emerge/distfiles/" EMERGE_DEFAULT_OPTS="--ask --buildpkg" FCFLAGS="-O2 -pipe" FEATURES="assume-digests binpkg-logs buildpkg config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync multilib-strict news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync" FFLAGS="-O2 -pipe" GENTOO_MIRRORS="http://distfiles.gentoo.org" LANG="en_US.UTF-8" LDFLAGS="-Wl,-O1 -Wl,--as-needed" LINGUAS="en_US" MAKEOPTS="-j3" PKGDIR="/emerge/packages/" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git" PORTAGE_TMPDIR="/var/tmp/" USE="X acl alsa amd64 berkdb bindist bzip2 cairo cjk cli crypt cxx dri exif fbcon ffmpeg fontconfig fortran gdbm gif gimp gmp gnutls gpm iconv icu imagemagick imlib ipv6 jbig jpeg lcms libkms libproxy lz4 lzma lzo modules multilib ncurses netlink netpbm nls nptl opencl openexr opengl openmp pam pango pcre png python rar readline sdl seccomp ssl svg tcpd threads tiff truetype unicode webp xface xft xpm xz zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx sse sse2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntripnavcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="evdev keyboard mouse synaptics" KERNEL="linux" L10N="en-US" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6 php7-0" POSTGRES_TARGETS="postgres9_5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4 python3_5" QEMU_SOFTMMU_TARGETS="arm i386 x86_64" QEMU_USER_TARGETS="arm i386 x86_64" RUBY_TARGETS="ruby22" USERLAND="GNU" VIDEO_CARDS="vesa fbdev modesetting radeon r600 vmware" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" Unset: CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
I dont' want to be pesky, but could you rephrase the first line of your commit message to fit on a single line (78 chars) and start with "read_repos_conf: "? I think you use Gnu style commits, but in Gentoo we use Git-style (I believe it is called). Otherwise, looks good to me.
Comment on attachment 513698 [details, diff] [PATCH] read_repos_conf: reject ~ postfixed files (aka backup files) From 1d2b033fb09ce22171af8853961961dfbd8d0a0b Mon Sep 17 00:00:00 2001 From: Matthew White <mehw.is.me@inventati.org> Date: Sun, 7 Jan 2018 07:10:01 +0100 Subject: [PATCH] read_repos_conf: reject ~ postfixed files (aka backup files) * main.c (read_repos_conf): Exclude backup files (aka files with ~ as postfix) from processing when reading the repos_conf directory. The old behaviour was to process any file found in repos_conf (i.e. /etc/portage/repos.conf/*), except those beginning with '.'. This meant that '.', '..', and '.file' are rejected, but 'file.conf~' is accepted. Since 'file.conf~' is a backup file, by default it should rather not be processed. --- main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main.c b/main.c index d124695..4f4af0d 100644 --- a/main.c +++ b/main.c @@ -504,6 +504,10 @@ read_repos_conf(const char *configroot, const char *repos_conf) if (name[0] == '.') continue; + /* Exclude backup files (aka files with ~ as postfix). */ + if (name[0] != '\0' && name[strlen(name) - 1] == '~') + continue; + #ifdef DT_UNKNOWN if (confs[i]->d_type != DT_UNKNOWN && confs[i]->d_type != DT_REG && -- 2.13.6
(In reply to Fabian Groffen from comment #2) > I dont' want to be pesky, but could you rephrase the first line of your > commit message to fit on a single line (78 chars) and start with > "read_repos_conf: "? > > I think you use Gnu style commits, but in Gentoo we use Git-style (I believe > it is called). Otherwise, looks good to me. Thanks for the tip! I just modified the patch changing the first line (Subject, right?)... but I messed up posting the patch as a comment two times... Is there any hope to remove the patch comments and replace/modify the patch attachment directly? Fingers crossed... PS: please, tell me if there is anything else (I hope to not mess up the next time).
I think, if you want to use git itself, you can do git rebase -i HEAD~1 and then use the reword action on your commit (this might be the most complex way to do it, but I know that's how you can do it ;))
I did use `git commit --amend` as an alternative to `git rebase -i HEAD~1` and reword, since it is my last commit. The problem is that I tryed to modify the bug report's attachment directly, and ended up adding a comment instead (...two comments, same error done twice...). My fault, sorry. Should I attach the new patch with the change you suggested to the bug report? Is it possible then to remove the "patch comments", and just keep the new attachment? Thanks.
Ah, now I see. You can add a new attachment, and select that it obsoletes the previous one.
Created attachment 513756 [details, diff] [PATCH] read_repos_conf: reject ~ postfixed files (aka backup files)
(In reply to Fabian Groffen from comment #8) > Ah, now I see. You can add a new attachment, and select that it obsoletes > the previous one. Ok, just did. Thanks! I'm sorry to bother you again. I do care if it's possible to remove the extra "patch comments". I'm worried about possible spamming, and as the registration page suggested I used a spare email to open my account and report bugs... Let me explain better, in the "patch comments" I posted by mistake there is another email which I prefer not to show upfront (showing it in the attachment I think it's ok). What do you think?
I will use wget "bugzie-url-ro-attachment" -O - | git am --signoff, so whatever is in the attachement will be recorded, the rest is discarded.
I'm positive about having my main email (the one in the attachment) in the commit. I think --signoff should not remove it. My preoccupation is about comment 3 and comment 4 (what I confusely called "patch comments") which I posted by mistake, since they contain my main email. I'm sorry for my lack of clarity, I shouldn't have used the expression "patch comments"... Can you remove comment 3 and comment 4? Thanks again.
I can't remove comments, but I can promise you they won't end up in the git commit.
Ok, good to know. Cheers.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=604df91aa544b65a6630b281b8a91d811c24e3f6 commit 604df91aa544b65a6630b281b8a91d811c24e3f6 Author: Matthew White <mehw.is.me@inventati.org> AuthorDate: 2018-01-07 06:10:01 +0000 Commit: Fabian Groffen <grobian@gentoo.org> CommitDate: 2018-01-08 12:32:27 +0000 read_repos_conf: reject ~ postfixed files (aka backup files) * main.c (read_repos_conf): Exclude backup files (aka files with ~ as postfix) from processing when reading the repos_conf directory. The old behaviour was to process any file found in repos_conf (i.e. /etc/portage/repos.conf/*), except those beginning with '.'. This meant that '.', '..', and '.file' are rejected, but 'file.conf~' is accepted. Since 'file.conf~' is a backup file, by default it should rather not be processed. Bug: https://bugs.gentoo.org/643820 Signed-off-by: Fabian Groffen <grobian@gentoo.org> main.c | 4 ++++ 1 file changed, 4 insertions(+)}
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=34b636503cc7dcabe32b9b377c2eb77cb5fd5575 commit 34b636503cc7dcabe32b9b377c2eb77cb5fd5575 Author: Fabian Groffen <grobian@gentoo.org> AuthorDate: 2018-04-05 19:02:10 +0000 Commit: Fabian Groffen <grobian@gentoo.org> CommitDate: 2018-04-05 19:02:34 +0000 app-portage/portage-utils: version bump to 0.70 This release fixes multiple bugs lingering around for a while. Closes: https://bugs.gentoo.org/651546 Closes: https://bugs.gentoo.org/646310 Closes: https://bugs.gentoo.org/645554 Closes: https://bugs.gentoo.org/643820 Closes: https://bugs.gentoo.org/638032 Closes: https://bugs.gentoo.org/608960 Closes: https://bugs.gentoo.org/607498 Closes: https://bugs.gentoo.org/558306 Closes: https://bugs.gentoo.org/526596 Closes: https://bugs.gentoo.org/470168 Closes: https://bugs.gentoo.org/351100 Closes: https://bugs.gentoo.org/335453 Package-Manager: Portage-2.3.24, Repoman-2.3.6 app-portage/portage-utils/Manifest | 2 +- .../portage-utils/portage-utils-0.62.ebuild | 2 +- .../portage-utils/portage-utils-0.63.ebuild | 43 ---------------------- ...ls-0.64-r1.ebuild => portage-utils-0.70.ebuild} | 16 +------- 4 files changed, 4 insertions(+), 59 deletions(-)