public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/eudev:master commit in: src/udev/
@ 2021-02-09 19:08 Anthony G. Basile
  0 siblings, 0 replies; 5+ messages in thread
From: Anthony G. Basile @ 2021-02-09 19:08 UTC (permalink / raw
  To: gentoo-commits

commit:     9d4010a3629ebc1d915b7f2d3e2d7be83d79b4f4
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Tue Feb  9 12:22:37 2021 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Feb  9 19:07:34 2021 +0000
URL:        https://gitweb.gentoo.org/proj/eudev.git/commit/?id=9d4010a3

udevadm: hwdb: allow empty properties

Backport of https://github.com/systemd/systemd/commit/afe87974dd57741f74dd87165b251886f24c859f.

Will address shown error

> Error, empty key or value ' XKB_FIXED_VARIANT' in '/usr/lib/udev/hwdb.d/60-keyboard.hwdb'

caued by recent changes in sys-apps/hwids-20201207 [Link 1].

Link 1: https://github.com/gentoo/hwids/commit/f30071bbebc0685c645783024cae0f9f213a1458#diff-7b9ba9c30888b1b5b1fa008f185e4efaff34eaff2c13f35c38b2ae0416cd891eR1840
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>

 src/udev/udevadm-hwdb.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/udev/udevadm-hwdb.c b/src/udev/udevadm-hwdb.c
index 6bc108783..53b1b15c7 100644
--- a/src/udev/udevadm-hwdb.c
+++ b/src/udev/udevadm-hwdb.c
@@ -441,9 +441,8 @@ static int insert_data(struct trie *trie, struct udev_list *match_list,
         while (isblank(line[0]) && isblank(line[1]))
                 line++;
 
-        if (isempty(line + 1) || isempty(value)) {
-                log_error("Warning, empty %s in \"%s=%s\", ignoring",
-                          isempty(line + 1) ? "key" : "value",
+        if (isempty(line + 1)) {
+                log_error("Warning, empty key in \"%s=%s\", ignoring",
                           line, value);
                 return -EINVAL;
         }


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] proj/eudev:master commit in: src/udev/
@ 2021-02-09 19:08 Anthony G. Basile
  0 siblings, 0 replies; 5+ messages in thread
From: Anthony G. Basile @ 2021-02-09 19:08 UTC (permalink / raw
  To: gentoo-commits

commit:     14748acf5e6e11db07e61ac188d6d1e799f29c6a
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Tue Feb  9 12:17:06 2021 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Feb  9 19:07:34 2021 +0000
URL:        https://gitweb.gentoo.org/proj/eudev.git/commit/?id=14748acf

udevadm: hwdb: sync with systemd

Backports some changes from https://github.com/systemd/systemd/commit/6a34639e76b8b59233a97533b13836d5a44e8d4a.

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>

 src/udev/udevadm-hwdb.c | 44 +++++++++++++++++++++++++++++++-------------
 1 file changed, 31 insertions(+), 13 deletions(-)

diff --git a/src/udev/udevadm-hwdb.c b/src/udev/udevadm-hwdb.c
index 9df043835..6bc108783 100644
--- a/src/udev/udevadm-hwdb.c
+++ b/src/udev/udevadm-hwdb.c
@@ -426,21 +426,25 @@ static int insert_data(struct trie *trie, struct udev_list *match_list,
         char *value;
         struct udev_list_entry *entry;
 
+        assert(line[0] == ' ');
+
         value = strchr(line, '=');
         if (!value) {
-                log_error("Error, key/value pair expected but got '%s' in '%s':", line, filename);
+                log_error("Warning, key-value pair expected but got \"%s\", ignoring", line);
                 return -EINVAL;
         }
 
         value[0] = '\0';
         value++;
 
-        /* libudev requires properties to start with a space */
+        /* Replace multiple leading spaces by a single space */
         while (isblank(line[0]) && isblank(line[1]))
                 line++;
 
-        if (line[0] == '\0' || value[0] == '\0') {
-                log_error("Error, empty key or value '%s' in '%s':", line, filename);
+        if (isempty(line + 1) || isempty(value)) {
+                log_error("Warning, empty %s in \"%s=%s\", ignoring",
+                          isempty(line + 1) ? "key" : "value",
+                          line, value);
                 return -EINVAL;
         }
 
@@ -459,17 +463,21 @@ static int import_file(struct udev *udev, struct trie *trie, const char *filenam
         FILE *f;
         char line[LINE_MAX];
         struct udev_list match_list;
+        uint32_t line_number = 0;
+        int r = 0, err;
 
         udev_list_init(udev, &match_list, false);
 
         f = fopen(filename, "re");
-        if (f == NULL)
+        if (!f)
                 return -errno;
 
         while (fgets(line, sizeof(line), f)) {
                 size_t len;
                 char *pos;
 
+                ++line_number;
+
                 /* comment line */
                 if (line[0] == '#')
                         continue;
@@ -491,7 +499,8 @@ static int import_file(struct udev *udev, struct trie *trie, const char *filenam
                                 break;
 
                         if (line[0] == ' ') {
-                                log_error("Error, MATCH expected but got '%s' in '%s':", line, filename);
+                                log_error("Warning, match expected but got indented property \"%s\", ignoring line", line);
+                                r = -EINVAL;
                                 break;
                         }
 
@@ -502,46 +511,55 @@ static int import_file(struct udev *udev, struct trie *trie, const char *filenam
 
                 case HW_MATCH:
                         if (len == 0) {
-                                log_error("Error, DATA expected but got empty line in '%s':", filename);
+                                log_error("Warning, property expected, ignoring record with no properties");
+                                r = -EINVAL;
                                 state = HW_NONE;
                                 udev_list_cleanup(&match_list);
                                 break;
                         }
 
-                        /* another match */
                         if (line[0] != ' ') {
+                                /* another match */
                                 udev_list_entry_add(&match_list, line, NULL);
                                 break;
                         }
 
                         /* first data */
                         state = HW_DATA;
-                        insert_data(trie, &match_list, line, filename);
+                        err = insert_data(trie, &match_list, line, filename);
+                        if (err < 0)
+                                r = err;
                         break;
 
                 case HW_DATA:
-                        /* end of record */
                         if (len == 0) {
+                                /* end of record */
                                 state = HW_NONE;
                                 udev_list_cleanup(&match_list);
                                 break;
                         }
 
                         if (line[0] != ' ') {
-                                log_error("Error, DATA expected but got '%s' in '%s':", line, filename);
+                                log_error("Warning, property or empty line expected, got \"%s\", ignoring record", line);
+                                r = -EINVAL;
                                 state = HW_NONE;
                                 udev_list_cleanup(&match_list);
                                 break;
                         }
 
-                        insert_data(trie, &match_list, line, filename);
+                        err = insert_data(trie, &match_list, line, filename);
+                        if (err < 0)
+                                r = err;
                         break;
                 };
         }
 
+        if (state == HW_MATCH)
+                log_error("Warning, property expected, ignoring record with no properties");
+
         fclose(f);
         udev_list_cleanup(&match_list);
-        return 0;
+        return r;
 }
 
 static void help(void) {


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] proj/eudev:master commit in: src/udev/
@ 2021-08-23 15:55 Anthony G. Basile
  0 siblings, 0 replies; 5+ messages in thread
From: Anthony G. Basile @ 2021-08-23 15:55 UTC (permalink / raw
  To: gentoo-commits

commit:     61d3f3997561d49b27b0779302de2f2b5209aabd
Author:     Issam E. Maghni <issam.e.maghni <AT> mailbox <DOT> org>
AuthorDate: Wed Mar 10 23:26:35 2021 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Mon Aug 23 15:55:44 2021 +0000
URL:        https://gitweb.gentoo.org/proj/eudev.git/commit/?id=61d3f399

Makefile: flag -n of ln is not POSIX

Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>

 src/udev/Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/udev/Makefile.am b/src/udev/Makefile.am
index 9b4917ad9..36c887e8d 100644
--- a/src/udev/Makefile.am
+++ b/src/udev/Makefile.am
@@ -137,7 +137,7 @@ CLEANFILES += \
 # install udevadm symlink in sbindir
 install-exec-hook:
 	test "$(bindir)" = "$(sbindir)" || \
-		$(LN_S) -n -f $(bindir)/udevadm $(DESTDIR)$(sbindir)/udevadm
+		$(LN_S) -f $(bindir)/udevadm $(DESTDIR)$(sbindir)/udevadm
 
 uninstall-hook:
 	rm -Rf $(DESTDIR)$(sbindir)/udevadm


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] proj/eudev:master commit in: src/udev/
@ 2021-08-23 16:03 Anthony G. Basile
  0 siblings, 0 replies; 5+ messages in thread
From: Anthony G. Basile @ 2021-08-23 16:03 UTC (permalink / raw
  To: gentoo-commits

commit:     841cd0ce3f6b97fbf77e12a6018a2c4a633eba89
Author:     Andoni Zarate <aiz <AT> arteche <DOT> es>
AuthorDate: Fri Apr 23 10:32:47 2021 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Mon Aug 23 16:03:05 2021 +0000
URL:        https://gitweb.gentoo.org/proj/eudev.git/commit/?id=841cd0ce

On collision rename my name to a temporal one letting others got my name...

Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>

 src/udev/udev-event.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
index 4120c04f2..64cc69cbc 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
@@ -826,6 +826,7 @@ static int rename_netif_dev_fromname_toname(struct udev_device *dev,const char *
 
 #ifdef ENABLE_RULE_GENERATOR
 	int loop;
+    struct ifreq ifr_tmp;
 
 	if (r == 0) {
 		log_info("renamed network interface %s to %s\n", ifr.ifr_name, ifr.ifr_newname);
@@ -835,6 +836,16 @@ static int rename_netif_dev_fromname_toname(struct udev_device *dev,const char *
 	log_debug("collision on rename of network interface %s to %s , retrying until timeout\n",
 		ifr.ifr_name, ifr.ifr_newname);
 
+	/* there has been a collision so rename my name to a temporal name, letting other one to rename to my name, freeying its name... */
+        memzero(&ifr_tmp, sizeof(struct ifreq));
+        strscpy(ifr_tmp.ifr_name, IFNAMSIZ, oldname);
+	snprintf(ifr_tmp.ifr_newname, IFNAMSIZ, "rename_%s", oldname);
+        r = ioctl(sk, SIOCSIFNAME, &ifr_tmp);
+		log_info("Temporarily renamed network interface %s to %s\n", ifr_tmp.ifr_name, ifr_tmp.ifr_newname);
+	
+	/* we have changed our name so in subsequents tries i should rename my temporal name to the wanted one */
+        strscpy(ifr.ifr_name, IFNAMSIZ, ifr_tmp.ifr_newname);
+
 	r = -errno;
 	if (r != -EEXIST)
 		goto out;


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] proj/eudev:master commit in: src/udev/
@ 2021-08-23 16:06 Anthony G. Basile
  0 siblings, 0 replies; 5+ messages in thread
From: Anthony G. Basile @ 2021-08-23 16:06 UTC (permalink / raw
  To: gentoo-commits

commit:     226a9f4dedae29d22e333c215d32d25292da0a78
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 23 16:06:49 2021 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Mon Aug 23 16:06:49 2021 +0000
URL:        https://gitweb.gentoo.org/proj/eudev.git/commit/?id=226a9f4d

src/udev/udev-event.c: clean up whitespaces

Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>

 src/udev/udev-event.c | 72 +++++++++++++++++++++++++--------------------------
 1 file changed, 36 insertions(+), 36 deletions(-)

diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
index 64cc69cbc..1c1b0d273 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
@@ -813,7 +813,7 @@ static int rename_netif_dev_fromname_toname(struct udev_device *dev,const char *
         int sk;
         struct ifreq ifr;
 
-	log_debug("changing net interface name from '%s' to '%s'\n",oldname,name);
+        log_debug("changing net interface name from '%s' to '%s'\n",oldname,name);
 
         sk = socket(PF_INET, SOCK_DGRAM, 0);
         if (sk < 0)
@@ -825,61 +825,61 @@ static int rename_netif_dev_fromname_toname(struct udev_device *dev,const char *
         r = ioctl(sk, SIOCSIFNAME, &ifr);
 
 #ifdef ENABLE_RULE_GENERATOR
-	int loop;
+        int loop;
     struct ifreq ifr_tmp;
 
-	if (r == 0) {
-		log_info("renamed network interface %s to %s\n", ifr.ifr_name, ifr.ifr_newname);
-		goto out;
-	}
-	/* keep trying if the destination interface name already exists */
-	log_debug("collision on rename of network interface %s to %s , retrying until timeout\n",
-		ifr.ifr_name, ifr.ifr_newname);
+        if (r == 0) {
+                log_info("renamed network interface %s to %s\n", ifr.ifr_name, ifr.ifr_newname);
+                goto out;
+        }
+        /* keep trying if the destination interface name already exists */
+        log_debug("collision on rename of network interface %s to %s , retrying until timeout\n",
+                ifr.ifr_name, ifr.ifr_newname);
 
-	/* there has been a collision so rename my name to a temporal name, letting other one to rename to my name, freeying its name... */
+        /* there has been a collision so rename my name to a temporal name, letting other one to rename to my name, freeying its name... */
         memzero(&ifr_tmp, sizeof(struct ifreq));
         strscpy(ifr_tmp.ifr_name, IFNAMSIZ, oldname);
-	snprintf(ifr_tmp.ifr_newname, IFNAMSIZ, "rename_%s", oldname);
+        snprintf(ifr_tmp.ifr_newname, IFNAMSIZ, "rename_%s", oldname);
         r = ioctl(sk, SIOCSIFNAME, &ifr_tmp);
-		log_info("Temporarily renamed network interface %s to %s\n", ifr_tmp.ifr_name, ifr_tmp.ifr_newname);
-	
-	/* we have changed our name so in subsequents tries i should rename my temporal name to the wanted one */
+                log_info("Temporarily renamed network interface %s to %s\n", ifr_tmp.ifr_name, ifr_tmp.ifr_newname);
+
+        /* we have changed our name so in subsequents tries i should rename my temporal name to the wanted one */
         strscpy(ifr.ifr_name, IFNAMSIZ, ifr_tmp.ifr_newname);
 
-	r = -errno;
-	if (r != -EEXIST)
-		goto out;
+        r = -errno;
+        if (r != -EEXIST)
+                goto out;
 
-	/* wait a maximum of 90 seconds for our target to become available */
-	loop = 90 * 20;
-	while (loop--) {
-		const struct timespec duration = { 0, 1000 * 1000 * 1000 / 20 };
+        /* wait a maximum of 90 seconds for our target to become available */
+        loop = 90 * 20;
+        while (loop--) {
+                const struct timespec duration = { 0, 1000 * 1000 * 1000 / 20 };
 
-		nanosleep(&duration, NULL);
+                nanosleep(&duration, NULL);
 
-		r = ioctl(sk, SIOCSIFNAME, &ifr);
-		if (r == 0) {
-			log_info("renamed network interface %s to %s\n", ifr.ifr_name, ifr.ifr_newname);
-			break;
-		}
-		r = -errno;
-		if (r != -EEXIST)
-			break;
-	}
+                r = ioctl(sk, SIOCSIFNAME, &ifr);
+                if (r == 0) {
+                        log_info("renamed network interface %s to %s\n", ifr.ifr_name, ifr.ifr_newname);
+                        break;
+                }
+                r = -errno;
+                if (r != -EEXIST)
+                        break;
+        }
 
 out:
 #endif
-	if (r < 0)
+        if (r < 0)
                 log_error_errno(-errno, "Error changing net interface name %s to %s: %m\n", ifr.ifr_name, ifr.ifr_newname);
-	else
-	        log_debug("renamed network interface '%s' to '%s'", oldname, name);
+        else
+                log_debug("renamed network interface '%s' to '%s'", oldname, name);
 
         close(sk);
         return r;
 }
 
 static int rename_netif(struct udev_event *event) {
-	return rename_netif_dev_fromname_toname(event->dev,udev_device_get_sysname(event->dev),event->name);
+        return rename_netif_dev_fromname_toname(event->dev,udev_device_get_sysname(event->dev),event->name);
 }
 
 void udev_event_execute_rules(struct udev_event *event,
@@ -944,7 +944,7 @@ void udev_event_execute_rules(struct udev_event *event,
                  */
 
 #ifdef ENABLE_RULE_GENERATOR
-		int r;
+                int r;
                 if (udev_device_get_ifindex(dev) > 0 && streq(udev_device_get_action(dev), "add") &&
                     (event->name == NULL && (r=udev_rules_assigning_name_to(rules,udev_device_get_sysname(dev))) > 0 ||
                     event->name != NULL && !streq(event->name, udev_device_get_sysname(dev)))) {


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-08-23 16:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-23 16:03 [gentoo-commits] proj/eudev:master commit in: src/udev/ Anthony G. Basile
  -- strict thread matches above, loose matches on Subject: below --
2021-08-23 16:06 Anthony G. Basile
2021-08-23 15:55 Anthony G. Basile
2021-02-09 19:08 Anthony G. Basile
2021-02-09 19:08 Anthony G. Basile

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox