Re: [systemd-devel] [PATCH] util: don't consider trailing whitespaces as an empty string in split_quoted

2013-11-28 Thread Tom Gundersen
On Wed, Nov 27, 2013 at 7:12 PM, Dave Reisner d...@falconindy.com wrote:
 On Wed, Nov 27, 2013 at 06:45:06PM +0100, Tom Gundersen wrote:
 On Wed, Nov 27, 2013 at 6:00 PM, Lukas Nykryn lnyk...@redhat.com wrote:
  ---
   src/shared/util.c | 4 +++-
   1 file changed, 3 insertions(+), 1 deletion(-)
 
  diff --git a/src/shared/util.c b/src/shared/util.c
  index 3a4d196..c68ab09 100644
  --- a/src/shared/util.c
  +++ b/src/shared/util.c
  @@ -383,7 +383,9 @@ char *split_quoted(const char *c, size_t *l, char 
  **state) {
 
   current += strspn(current, WHITESPACE);
 
  -if (*current == '\'') {
  +if (*current == 0)
  +return NULL;
  +else if (*current == '\'') {
   current ++;
 
   for (e = current; *e; e++) {
  --
  1.8.3.1

 Dave,

 Is this the proper fix to the /proc/cmdline bug you told me about some
 time ago? What happened to that in the end?

 -t

 Oh, interesting... Yeah, this looks like it would. I suppose da66338e1
 could be reverted if this is merged.

Done.

-t
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH] util: don't consider trailing whitespaces as an empty string in split_quoted

2013-11-27 Thread Lukas Nykryn
---
 src/shared/util.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/shared/util.c b/src/shared/util.c
index 3a4d196..c68ab09 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -383,7 +383,9 @@ char *split_quoted(const char *c, size_t *l, char **state) {
 
 current += strspn(current, WHITESPACE);
 
-if (*current == '\'') {
+if (*current == 0)
+return NULL;
+else if (*current == '\'') {
 current ++;
 
 for (e = current; *e; e++) {
-- 
1.8.3.1

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] util: don't consider trailing whitespaces as an empty string in split_quoted

2013-11-27 Thread Tom Gundersen
On Wed, Nov 27, 2013 at 6:00 PM, Lukas Nykryn lnyk...@redhat.com wrote:
 ---
  src/shared/util.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

 diff --git a/src/shared/util.c b/src/shared/util.c
 index 3a4d196..c68ab09 100644
 --- a/src/shared/util.c
 +++ b/src/shared/util.c
 @@ -383,7 +383,9 @@ char *split_quoted(const char *c, size_t *l, char 
 **state) {

  current += strspn(current, WHITESPACE);

 -if (*current == '\'') {
 +if (*current == 0)
 +return NULL;
 +else if (*current == '\'') {
  current ++;

  for (e = current; *e; e++) {
 --
 1.8.3.1

Dave,

Is this the proper fix to the /proc/cmdline bug you told me about some
time ago? What happened to that in the end?

-t
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] util: don't consider trailing whitespaces as an empty string in split_quoted

2013-11-27 Thread Dave Reisner
On Wed, Nov 27, 2013 at 06:45:06PM +0100, Tom Gundersen wrote:
 On Wed, Nov 27, 2013 at 6:00 PM, Lukas Nykryn lnyk...@redhat.com wrote:
  ---
   src/shared/util.c | 4 +++-
   1 file changed, 3 insertions(+), 1 deletion(-)
 
  diff --git a/src/shared/util.c b/src/shared/util.c
  index 3a4d196..c68ab09 100644
  --- a/src/shared/util.c
  +++ b/src/shared/util.c
  @@ -383,7 +383,9 @@ char *split_quoted(const char *c, size_t *l, char 
  **state) {
 
   current += strspn(current, WHITESPACE);
 
  -if (*current == '\'') {
  +if (*current == 0)
  +return NULL;
  +else if (*current == '\'') {
   current ++;
 
   for (e = current; *e; e++) {
  --
  1.8.3.1
 
 Dave,
 
 Is this the proper fix to the /proc/cmdline bug you told me about some
 time ago? What happened to that in the end?
 
 -t

Oh, interesting... Yeah, this looks like it would. I suppose da66338e1
could be reverted if this is merged.

d
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] util: don't consider trailing whitespaces as an empty string in split_quoted

2013-11-27 Thread Lennart Poettering
On Wed, 27.11.13 18:00, Lukas Nykryn (lnyk...@redhat.com) wrote:

I merged a different patch that simply moves the earlier NUL byte check
after the jumping over whitespace, so that we don't need two checks. I
also added a test case for this, so that this doesn't break again.

(That sad, the whole function is moronic, since it doesn't really do any
sane unescaping of quotes inside of strings... We should rewrite this
one day, and maybe do it in a smart way that allocates a dynamically
sized string of the current word on the stack...)

 ---
  src/shared/util.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
 
 diff --git a/src/shared/util.c b/src/shared/util.c
 index 3a4d196..c68ab09 100644
 --- a/src/shared/util.c
 +++ b/src/shared/util.c
 @@ -383,7 +383,9 @@ char *split_quoted(const char *c, size_t *l, char 
 **state) {
  
  current += strspn(current, WHITESPACE);
  
 -if (*current == '\'') {
 +if (*current == 0)
 +return NULL;
 +else if (*current == '\'') {
  current ++;
  
  for (e = current; *e; e++) {


Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel