* [PATCH v7 04/17] ref-filter: modify "%(objectname:short)" to take length
From: Karthik Nayak @ 2016-11-08 20:11 UTC (permalink / raw)
To: git; +Cc: jacob.keller, Karthik Nayak
In-Reply-To: <20161108201211.25213-1-Karthik.188@gmail.com>
From: Karthik Nayak <karthik.188@gmail.com>
Add support for %(objectname:short=<length>) which would print the
abbreviated unique objectname of given length. When no length is
specified, the length is 'DEFAULT_ABBREV'. The minimum length is
'MINIMUM_ABBREV'. The length may be exceeded to ensure that the provided
object name is unique.
Add tests and documentation for the same.
Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Helped-by: Jacob Keller <jacob.keller@gmail.com>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
---
Documentation/git-for-each-ref.txt | 4 ++++
ref-filter.c | 25 +++++++++++++++++++------
t/t6300-for-each-ref.sh | 10 ++++++++++
3 files changed, 33 insertions(+), 6 deletions(-)
diff --git a/Documentation/git-for-each-ref.txt b/Documentation/git-for-each-ref.txt
index b7b8560..92184c4 100644
--- a/Documentation/git-for-each-ref.txt
+++ b/Documentation/git-for-each-ref.txt
@@ -107,6 +107,10 @@ objectsize::
objectname::
The object name (aka SHA-1).
For a non-ambiguous abbreviation of the object name append `:short`.
+ For an abbreviation of the object name with desired length append
+ `:short=<length>`, where the minimum length is MINIMUM_ABBREV. The
+ length may be exceeded to ensure unique object names.
+
upstream::
The name of a local ref which can be considered ``upstream''
diff --git a/ref-filter.c b/ref-filter.c
index 44481c3..fe4ea2b 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -55,7 +55,10 @@ static struct used_atom {
const char *if_equals,
*not_equals;
} if_then_else;
- enum { O_FULL, O_SHORT } objectname;
+ struct {
+ enum { O_FULL, O_LENGTH, O_SHORT } option;
+ unsigned int length;
+ } objectname;
} u;
} *used_atom;
static int used_atom_cnt, need_tagged, need_symref;
@@ -118,10 +121,17 @@ static void contents_atom_parser(struct used_atom *atom, const char *arg)
static void objectname_atom_parser(struct used_atom *atom, const char *arg)
{
if (!arg)
- atom->u.objectname = O_FULL;
+ atom->u.objectname.option = O_FULL;
else if (!strcmp(arg, "short"))
- atom->u.objectname = O_SHORT;
- else
+ atom->u.objectname.option = O_SHORT;
+ else if (skip_prefix(arg, "short=", &arg)) {
+ atom->u.objectname.option = O_LENGTH;
+ if (strtoul_ui(arg, 10, &atom->u.objectname.length) ||
+ atom->u.objectname.length == 0)
+ die(_("positive value expected objectname:short=%s"), arg);
+ if (atom->u.objectname.length < MINIMUM_ABBREV)
+ atom->u.objectname.length = MINIMUM_ABBREV;
+ } else
die(_("unrecognized %%(objectname) argument: %s"), arg);
}
@@ -591,12 +601,15 @@ static int grab_objectname(const char *name, const unsigned char *sha1,
struct atom_value *v, struct used_atom *atom)
{
if (starts_with(name, "objectname")) {
- if (atom->u.objectname == O_SHORT) {
+ if (atom->u.objectname.option == O_SHORT) {
v->s = xstrdup(find_unique_abbrev(sha1, DEFAULT_ABBREV));
return 1;
- } else if (atom->u.objectname == O_FULL) {
+ } else if (atom->u.objectname.option == O_FULL) {
v->s = xstrdup(sha1_to_hex(sha1));
return 1;
+ } else if (atom->u.objectname.option == O_LENGTH) {
+ v->s = xstrdup(find_unique_abbrev(sha1, atom->u.objectname.length));
+ return 1;
} else
die("BUG: unknown %%(objectname) option");
}
diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh
index 19a2823..2be0a3f 100755
--- a/t/t6300-for-each-ref.sh
+++ b/t/t6300-for-each-ref.sh
@@ -60,6 +60,8 @@ test_atom head objecttype commit
test_atom head objectsize 171
test_atom head objectname $(git rev-parse refs/heads/master)
test_atom head objectname:short $(git rev-parse --short refs/heads/master)
+test_atom head objectname:short=1 $(git rev-parse --short=1 refs/heads/master)
+test_atom head objectname:short=10 $(git rev-parse --short=10 refs/heads/master)
test_atom head tree $(git rev-parse refs/heads/master^{tree})
test_atom head parent ''
test_atom head numparent 0
@@ -99,6 +101,8 @@ test_atom tag objecttype tag
test_atom tag objectsize 154
test_atom tag objectname $(git rev-parse refs/tags/testtag)
test_atom tag objectname:short $(git rev-parse --short refs/tags/testtag)
+test_atom head objectname:short=1 $(git rev-parse --short=1 refs/heads/master)
+test_atom head objectname:short=10 $(git rev-parse --short=10 refs/heads/master)
test_atom tag tree ''
test_atom tag parent ''
test_atom tag numparent ''
@@ -164,6 +168,12 @@ test_expect_success 'Check invalid format specifiers are errors' '
test_must_fail git for-each-ref --format="%(authordate:INVALID)" refs/heads
'
+test_expect_success 'arguments to %(objectname:short=) must be positive integers' '
+ test_must_fail git for-each-ref --format="%(objectname:short=0)" &&
+ test_must_fail git for-each-ref --format="%(objectname:short=-1)" &&
+ test_must_fail git for-each-ref --format="%(objectname:short=foo)"
+'
+
test_date () {
f=$1 &&
committer_date=$2 &&
--
2.10.2
^ permalink raw reply related
* [PATCH v7 05/17] ref-filter: move get_head_description() from branch.c
From: Karthik Nayak @ 2016-11-08 20:11 UTC (permalink / raw)
To: git; +Cc: jacob.keller, Karthik Nayak
In-Reply-To: <20161108201211.25213-1-Karthik.188@gmail.com>
From: Karthik Nayak <karthik.188@gmail.com>
Move the implementation of get_head_description() from branch.c to
ref-filter. This gives a description of the HEAD ref if called. This
is used as the refname for the HEAD ref whenever the
FILTER_REFS_DETACHED_HEAD option is used. Make it public because we
need it to calculate the length of the HEAD refs description in
branch.c:calc_maxwidth() when we port branch.c to use ref-filter
APIs.
Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
---
builtin/branch.c | 33 ---------------------------------
ref-filter.c | 38 ++++++++++++++++++++++++++++++++++++--
ref-filter.h | 2 ++
3 files changed, 38 insertions(+), 35 deletions(-)
diff --git a/builtin/branch.c b/builtin/branch.c
index d5d93a8..be9773a 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -364,39 +364,6 @@ static void add_verbose_info(struct strbuf *out, struct ref_array_item *item,
strbuf_release(&subject);
}
-static char *get_head_description(void)
-{
- struct strbuf desc = STRBUF_INIT;
- struct wt_status_state state;
- memset(&state, 0, sizeof(state));
- wt_status_get_state(&state, 1);
- if (state.rebase_in_progress ||
- state.rebase_interactive_in_progress)
- strbuf_addf(&desc, _("(no branch, rebasing %s)"),
- state.branch);
- else if (state.bisect_in_progress)
- strbuf_addf(&desc, _("(no branch, bisect started on %s)"),
- state.branch);
- else if (state.detached_from) {
- if (state.detached_at)
- /* TRANSLATORS: make sure this matches
- "HEAD detached at " in wt-status.c */
- strbuf_addf(&desc, _("(HEAD detached at %s)"),
- state.detached_from);
- else
- /* TRANSLATORS: make sure this matches
- "HEAD detached from " in wt-status.c */
- strbuf_addf(&desc, _("(HEAD detached from %s)"),
- state.detached_from);
- }
- else
- strbuf_addstr(&desc, _("(no branch)"));
- free(state.branch);
- free(state.onto);
- free(state.detached_from);
- return strbuf_detach(&desc, NULL);
-}
-
static void format_and_print_ref_item(struct ref_array_item *item, int maxwidth,
struct ref_filter *filter, const char *remote_prefix)
{
diff --git a/ref-filter.c b/ref-filter.c
index fe4ea2b..40bdf97 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -13,6 +13,7 @@
#include "utf8.h"
#include "git-compat-util.h"
#include "version.h"
+#include "wt-status.h"
typedef enum { FIELD_STR, FIELD_ULONG, FIELD_TIME } cmp_type;
@@ -1077,6 +1078,37 @@ static void fill_remote_ref_details(struct used_atom *atom, const char *refname,
*s = refname;
}
+char *get_head_description(void)
+{
+ struct strbuf desc = STRBUF_INIT;
+ struct wt_status_state state;
+ memset(&state, 0, sizeof(state));
+ wt_status_get_state(&state, 1);
+ if (state.rebase_in_progress ||
+ state.rebase_interactive_in_progress)
+ strbuf_addf(&desc, _("(no branch, rebasing %s)"),
+ state.branch);
+ else if (state.bisect_in_progress)
+ strbuf_addf(&desc, _("(no branch, bisect started on %s)"),
+ state.branch);
+ else if (state.detached_from) {
+ /* TRANSLATORS: make sure these match _("HEAD detached at ")
+ and _("HEAD detached from ") in wt-status.c */
+ if (state.detached_at)
+ strbuf_addf(&desc, _("(HEAD detached at %s)"),
+ state.detached_from);
+ else
+ strbuf_addf(&desc, _("(HEAD detached from %s)"),
+ state.detached_from);
+ }
+ else
+ strbuf_addstr(&desc, _("(no branch)"));
+ free(state.branch);
+ free(state.onto);
+ free(state.detached_from);
+ return strbuf_detach(&desc, NULL);
+}
+
/*
* Parse the object referred by ref, and grab needed value.
*/
@@ -1116,9 +1148,11 @@ static void populate_value(struct ref_array_item *ref)
name++;
}
- if (starts_with(name, "refname"))
+ if (starts_with(name, "refname")) {
refname = ref->refname;
- else if (starts_with(name, "symref"))
+ if (ref->kind & FILTER_REFS_DETACHED_HEAD)
+ refname = get_head_description();
+ } else if (starts_with(name, "symref"))
refname = ref->symref ? ref->symref : "";
else if (starts_with(name, "upstream")) {
const char *branch_name;
diff --git a/ref-filter.h b/ref-filter.h
index 14d435e..4aea594 100644
--- a/ref-filter.h
+++ b/ref-filter.h
@@ -106,5 +106,7 @@ int parse_opt_ref_sorting(const struct option *opt, const char *arg, int unset);
struct ref_sorting *ref_default_sorting(void);
/* Function to parse --merged and --no-merged options */
int parse_opt_merge_filter(const struct option *opt, const char *arg, int unset);
+/* Get the current HEAD's description */
+char *get_head_description(void);
#endif /* REF_FILTER_H */
--
2.10.2
^ permalink raw reply related
* [PATCH v7 06/17] ref-filter: introduce format_ref_array_item()
From: Karthik Nayak @ 2016-11-08 20:12 UTC (permalink / raw)
To: git; +Cc: jacob.keller, Karthik Nayak
In-Reply-To: <20161108201211.25213-1-Karthik.188@gmail.com>
From: Karthik Nayak <karthik.188@gmail.com>
To allow column display, we will need to first render the output in a
string list to allow print_columns() to compute the proper size of
each column before starting the actual output. Introduce the function
format_ref_array_item() that does the formatting of a ref_array_item
to an strbuf.
show_ref_array_item() is kept as a convenience wrapper around it which
obtains the strbuf and prints it the standard output.
Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
---
ref-filter.c | 16 ++++++++++++----
ref-filter.h | 3 +++
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/ref-filter.c b/ref-filter.c
index 40bdf97..b8b8a95 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -1795,10 +1795,10 @@ static void append_literal(const char *cp, const char *ep, struct ref_formatting
}
}
-void show_ref_array_item(struct ref_array_item *info, const char *format, int quote_style)
+void format_ref_array_item(struct ref_array_item *info, const char *format,
+ int quote_style, struct strbuf *final_buf)
{
const char *cp, *sp, *ep;
- struct strbuf *final_buf;
struct ref_formatting_state state = REF_FORMATTING_STATE_INIT;
state.quote_style = quote_style;
@@ -1828,9 +1828,17 @@ void show_ref_array_item(struct ref_array_item *info, const char *format, int qu
}
if (state.stack->prev)
die(_("format: %%(end) atom missing"));
- final_buf = &state.stack->output;
- fwrite(final_buf->buf, 1, final_buf->len, stdout);
+ strbuf_addbuf(final_buf, &state.stack->output);
pop_stack_element(&state.stack);
+}
+
+void show_ref_array_item(struct ref_array_item *info, const char *format, int quote_style)
+{
+ struct strbuf final_buf = STRBUF_INIT;
+
+ format_ref_array_item(info, format, quote_style, &final_buf);
+ fwrite(final_buf.buf, 1, final_buf.len, stdout);
+ strbuf_release(&final_buf);
putchar('\n');
}
diff --git a/ref-filter.h b/ref-filter.h
index 4aea594..0014b92 100644
--- a/ref-filter.h
+++ b/ref-filter.h
@@ -98,6 +98,9 @@ int parse_ref_filter_atom(const char *atom, const char *ep);
int verify_ref_format(const char *format);
/* Sort the given ref_array as per the ref_sorting provided */
void ref_array_sort(struct ref_sorting *sort, struct ref_array *array);
+/* Based on the given format and quote_style, fill the strbuf */
+void format_ref_array_item(struct ref_array_item *info, const char *format,
+ int quote_style, struct strbuf *final_buf);
/* Print the ref using the given format and quote_style */
void show_ref_array_item(struct ref_array_item *info, const char *format, int quote_style);
/* Callback function for parsing the sort option */
--
2.10.2
^ permalink raw reply related
* [PATCH v7 08/17] ref-filter: add support for %(upstream:track,nobracket)
From: Karthik Nayak @ 2016-11-08 20:12 UTC (permalink / raw)
To: git; +Cc: jacob.keller, Karthik Nayak
In-Reply-To: <20161108201211.25213-1-Karthik.188@gmail.com>
From: Karthik Nayak <karthik.188@gmail.com>
Add support for %(upstream:track,nobracket) which will print the
tracking information without the brackets (i.e. "ahead N, behind M").
This is needed when we port branch.c to use ref-filter's printing APIs.
Add test and documentation for the same.
Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
---
Documentation/git-for-each-ref.txt | 8 +++--
ref-filter.c | 67 +++++++++++++++++++++++++-------------
t/t6300-for-each-ref.sh | 2 ++
3 files changed, 51 insertions(+), 26 deletions(-)
diff --git a/Documentation/git-for-each-ref.txt b/Documentation/git-for-each-ref.txt
index fd365eb..3953431 100644
--- a/Documentation/git-for-each-ref.txt
+++ b/Documentation/git-for-each-ref.txt
@@ -118,9 +118,11 @@ upstream::
`refname` above. Additionally respects `:track` to show
"[ahead N, behind M]" and `:trackshort` to show the terse
version: ">" (ahead), "<" (behind), "<>" (ahead and behind),
- or "=" (in sync). Has no effect if the ref does not have
- tracking information associated with it. `:track` also prints
- "[gone]" whenever unknown upstream ref is encountered.
+ or "=" (in sync). `:track` also prints "[gone]" whenever
+ unknown upstream ref is encountered. Append `:track,nobracket`
+ to show tracking information without brackets (i.e "ahead N,
+ behind M"). Has no effect if the ref does not have tracking
+ information associated with it.
push::
The name of a local ref which represents the `@{push}` location
diff --git a/ref-filter.c b/ref-filter.c
index 6d51b80..4d7e414 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -46,8 +46,10 @@ static struct used_atom {
union {
char color[COLOR_MAXLEN];
struct align align;
- enum { RR_NORMAL, RR_SHORTEN, RR_TRACK, RR_TRACKSHORT }
- remote_ref;
+ struct {
+ enum { RR_NORMAL, RR_SHORTEN, RR_TRACK, RR_TRACKSHORT } option;
+ unsigned int nobracket: 1;
+ } remote_ref;
struct {
enum { C_BARE, C_BODY, C_BODY_DEP, C_LINES, C_SIG, C_SUB } option;
unsigned int nlines;
@@ -75,16 +77,33 @@ static void color_atom_parser(struct used_atom *atom, const char *color_value)
static void remote_ref_atom_parser(struct used_atom *atom, const char *arg)
{
- if (!arg)
- atom->u.remote_ref = RR_NORMAL;
- else if (!strcmp(arg, "short"))
- atom->u.remote_ref = RR_SHORTEN;
- else if (!strcmp(arg, "track"))
- atom->u.remote_ref = RR_TRACK;
- else if (!strcmp(arg, "trackshort"))
- atom->u.remote_ref = RR_TRACKSHORT;
- else
- die(_("unrecognized format: %%(%s)"), atom->name);
+ struct string_list params = STRING_LIST_INIT_DUP;
+ int i;
+
+ if (!arg) {
+ atom->u.remote_ref.option = RR_NORMAL;
+ return;
+ }
+
+ atom->u.remote_ref.nobracket = 0;
+ string_list_split(¶ms, arg, ',', -1);
+
+ for (i = 0; i < params.nr; i++) {
+ const char *s = params.items[i].string;
+
+ if (!strcmp(s, "short"))
+ atom->u.remote_ref.option = RR_SHORTEN;
+ else if (!strcmp(s, "track"))
+ atom->u.remote_ref.option = RR_TRACK;
+ else if (!strcmp(s, "trackshort"))
+ atom->u.remote_ref.option = RR_TRACKSHORT;
+ else if (!strcmp(s, "nobracket"))
+ atom->u.remote_ref.nobracket = 1;
+ else
+ die(_("unrecognized format: %%(%s)"), atom->name);
+ }
+
+ string_list_clear(¶ms, 0);
}
static void body_atom_parser(struct used_atom *atom, const char *arg)
@@ -1045,25 +1064,27 @@ static void fill_remote_ref_details(struct used_atom *atom, const char *refname,
struct branch *branch, const char **s)
{
int num_ours, num_theirs;
- if (atom->u.remote_ref == RR_SHORTEN)
+ if (atom->u.remote_ref.option == RR_SHORTEN)
*s = shorten_unambiguous_ref(refname, warn_ambiguous_refs);
- else if (atom->u.remote_ref == RR_TRACK) {
+ else if (atom->u.remote_ref.option == RR_TRACK) {
if (stat_tracking_info(branch, &num_ours,
&num_theirs, NULL)) {
- *s = "[gone]";
- return;
- }
-
- if (!num_ours && !num_theirs)
+ *s = xstrdup("gone");
+ } else if (!num_ours && !num_theirs)
*s = "";
else if (!num_ours)
- *s = xstrfmt("[behind %d]", num_theirs);
+ *s = xstrfmt("behind %d", num_theirs);
else if (!num_theirs)
- *s = xstrfmt("[ahead %d]", num_ours);
+ *s = xstrfmt("ahead %d", num_ours);
else
- *s = xstrfmt("[ahead %d, behind %d]",
+ *s = xstrfmt("ahead %d, behind %d",
num_ours, num_theirs);
- } else if (atom->u.remote_ref == RR_TRACKSHORT) {
+ if (!atom->u.remote_ref.nobracket && *s[0]) {
+ const char *to_free = *s;
+ *s = xstrfmt("[%s]", *s);
+ free((void *)to_free);
+ }
+ } else if (atom->u.remote_ref.option == RR_TRACKSHORT) {
if (stat_tracking_info(branch, &num_ours,
&num_theirs, NULL))
return;
diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh
index a92b36f..2c5f177 100755
--- a/t/t6300-for-each-ref.sh
+++ b/t/t6300-for-each-ref.sh
@@ -372,6 +372,8 @@ test_expect_success 'setup for upstream:track[short]' '
test_atom head upstream:track '[ahead 1]'
test_atom head upstream:trackshort '>'
+test_atom head upstream:track,nobracket 'ahead 1'
+test_atom head upstream:nobracket,track 'ahead 1'
test_atom head push:track '[ahead 1]'
test_atom head push:trackshort '>'
--
2.10.2
^ permalink raw reply related
* [PATCH v7 07/17] ref-filter: make %(upstream:track) prints "[gone]" for invalid upstreams
From: Karthik Nayak @ 2016-11-08 20:12 UTC (permalink / raw)
To: git; +Cc: jacob.keller, Karthik Nayak
In-Reply-To: <20161108201211.25213-1-Karthik.188@gmail.com>
From: Karthik Nayak <karthik.188@gmail.com>
Borrowing from branch.c's implementation print "[gone]" whenever an
unknown upstream ref is encountered instead of just ignoring it.
This makes sure that when branch.c is ported over to using ref-filter
APIs for printing, this feature is not lost.
Make changes to t/t6300-for-each-ref.sh and
Documentation/git-for-each-ref.txt to reflect this change.
Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Helped-by : Jacob Keller <jacob.keller@gmail.com>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
---
Documentation/git-for-each-ref.txt | 3 ++-
ref-filter.c | 4 +++-
t/t6300-for-each-ref.sh | 2 +-
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/Documentation/git-for-each-ref.txt b/Documentation/git-for-each-ref.txt
index 92184c4..fd365eb 100644
--- a/Documentation/git-for-each-ref.txt
+++ b/Documentation/git-for-each-ref.txt
@@ -119,7 +119,8 @@ upstream::
"[ahead N, behind M]" and `:trackshort` to show the terse
version: ">" (ahead), "<" (behind), "<>" (ahead and behind),
or "=" (in sync). Has no effect if the ref does not have
- tracking information associated with it.
+ tracking information associated with it. `:track` also prints
+ "[gone]" whenever unknown upstream ref is encountered.
push::
The name of a local ref which represents the `@{push}` location
diff --git a/ref-filter.c b/ref-filter.c
index b8b8a95..6d51b80 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -1049,8 +1049,10 @@ static void fill_remote_ref_details(struct used_atom *atom, const char *refname,
*s = shorten_unambiguous_ref(refname, warn_ambiguous_refs);
else if (atom->u.remote_ref == RR_TRACK) {
if (stat_tracking_info(branch, &num_ours,
- &num_theirs, NULL))
+ &num_theirs, NULL)) {
+ *s = "[gone]";
return;
+ }
if (!num_ours && !num_theirs)
*s = "";
diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh
index 2be0a3f..a92b36f 100755
--- a/t/t6300-for-each-ref.sh
+++ b/t/t6300-for-each-ref.sh
@@ -382,7 +382,7 @@ test_expect_success 'Check that :track[short] cannot be used with other atoms' '
test_expect_success 'Check that :track[short] works when upstream is invalid' '
cat >expected <<-\EOF &&
-
+ [gone]
EOF
test_when_finished "git config branch.master.merge refs/heads/master" &&
--
2.10.2
^ permalink raw reply related
* [PATCH v7 09/17] ref-filter: make "%(symref)" atom work with the ':short' modifier
From: Karthik Nayak @ 2016-11-08 20:12 UTC (permalink / raw)
To: git; +Cc: jacob.keller, Karthik Nayak, Karthik Nayak
In-Reply-To: <20161108201211.25213-1-Karthik.188@gmail.com>
From: Karthik Nayak <karthik.188@gmail.com>
The "%(symref)" atom doesn't work when used with the ':short' modifier
because we strictly match only 'symref' for setting the 'need_symref'
indicator. Fix this by using comparing with valid_atom rather than used_atom.
Add tests for %(symref) and %(symref:short) while we're here.
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
---
ref-filter.c | 2 +-
t/t6300-for-each-ref.sh | 24 ++++++++++++++++++++++++
2 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/ref-filter.c b/ref-filter.c
index 4d7e414..5666814 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -338,7 +338,7 @@ int parse_ref_filter_atom(const char *atom, const char *ep)
valid_atom[i].parser(&used_atom[at], arg);
if (*atom == '*')
need_tagged = 1;
- if (!strcmp(used_atom[at].name, "symref"))
+ if (!strcmp(valid_atom[i].name, "symref"))
need_symref = 1;
return at;
}
diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh
index 2c5f177..b06ea1c 100755
--- a/t/t6300-for-each-ref.sh
+++ b/t/t6300-for-each-ref.sh
@@ -38,6 +38,7 @@ test_atom() {
case "$1" in
head) ref=refs/heads/master ;;
tag) ref=refs/tags/testtag ;;
+ sym) ref=refs/heads/sym ;;
*) ref=$1 ;;
esac
printf '%s\n' "$3" >expected
@@ -565,4 +566,27 @@ test_expect_success 'Verify sort with multiple keys' '
refs/tags/bogo refs/tags/master > actual &&
test_cmp expected actual
'
+
+test_expect_success 'Add symbolic ref for the following tests' '
+ git symbolic-ref refs/heads/sym refs/heads/master
+'
+
+cat >expected <<EOF
+refs/heads/master
+EOF
+
+test_expect_success 'Verify usage of %(symref) atom' '
+ git for-each-ref --format="%(symref)" refs/heads/sym > actual &&
+ test_cmp expected actual
+'
+
+cat >expected <<EOF
+heads/master
+EOF
+
+test_expect_success 'Verify usage of %(symref:short) atom' '
+ git for-each-ref --format="%(symref:short)" refs/heads/sym > actual &&
+ test_cmp expected actual
+'
+
test_done
--
2.10.2
^ permalink raw reply related
* [PATCH v7 10/17] ref-filter: introduce refname_atom_parser_internal()
From: Karthik Nayak @ 2016-11-08 20:12 UTC (permalink / raw)
To: git; +Cc: jacob.keller, Karthik Nayak, Karthik Nayak
In-Reply-To: <20161108201211.25213-1-Karthik.188@gmail.com>
From: Karthik Nayak <karthik.188@gmail.com>
Since there are multiple atoms which print refs ('%(refname)',
'%(symref)', '%(push)', '%upstream'), it makes sense to have a common
ground for parsing them. This would allow us to share implementations of
the atom modifiers between these atoms.
Introduce refname_atom_parser_internal() to act as a common parsing
function for ref printing atoms. This would eventually be used to
introduce refname_atom_parser() and symref_atom_parser() and also be
internally used in remote_ref_atom_parser().
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
---
ref-filter.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/ref-filter.c b/ref-filter.c
index 5666814..aad537d 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -30,6 +30,11 @@ struct if_then_else {
condition_satisfied : 1;
};
+struct refname_atom {
+ enum { R_NORMAL, R_SHORT, R_STRIP } option;
+ unsigned int strip;
+};
+
/*
* An atom is a valid field atom listed below, possibly prefixed with
* a "*" to denote deref_tag().
@@ -62,6 +67,7 @@ static struct used_atom {
enum { O_FULL, O_LENGTH, O_SHORT } option;
unsigned int length;
} objectname;
+ struct refname_atom refname;
} u;
} *used_atom;
static int used_atom_cnt, need_tagged, need_symref;
@@ -75,6 +81,21 @@ static void color_atom_parser(struct used_atom *atom, const char *color_value)
die(_("unrecognized color: %%(color:%s)"), color_value);
}
+static void refname_atom_parser_internal(struct refname_atom *atom,
+ const char *arg, const char *name)
+{
+ if (!arg)
+ atom->option = R_NORMAL;
+ else if (!strcmp(arg, "short"))
+ atom->option = R_SHORT;
+ else if (skip_prefix(arg, "strip=", &arg)) {
+ atom->option = R_STRIP;
+ if (strtoul_ui(arg, 10, &atom->strip) || atom->strip <= 0)
+ die(_("positive value expected refname:strip=%s"), arg);
+ } else
+ die(_("unrecognized %%(%s) argument: %s"), name, arg);
+}
+
static void remote_ref_atom_parser(struct used_atom *atom, const char *arg)
{
struct string_list params = STRING_LIST_INIT_DUP;
--
2.10.2
^ permalink raw reply related
* [PATCH v7 11/17] ref-filter: introduce symref_atom_parser() and refname_atom_parser()
From: Karthik Nayak @ 2016-11-08 20:12 UTC (permalink / raw)
To: git; +Cc: jacob.keller, Karthik Nayak, Karthik Nayak
In-Reply-To: <20161108201211.25213-1-Karthik.188@gmail.com>
From: Karthik Nayak <karthik.188@gmail.com>
Using refname_atom_parser_internal(), introduce symref_atom_parser() and
refname_atom_parser() which will parse the atoms %(symref) and
%(refname) respectively. Store the parsed information into the
'used_atom' structure based on the modifiers used along with the atoms.
Now the '%(symref)' atom supports the ':strip' atom modifier. Update the
Documentation and tests to reflect this.
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
---
Documentation/git-for-each-ref.txt | 5 +++
ref-filter.c | 78 ++++++++++++++++++++++----------------
t/t6300-for-each-ref.sh | 9 +++++
3 files changed, 59 insertions(+), 33 deletions(-)
diff --git a/Documentation/git-for-each-ref.txt b/Documentation/git-for-each-ref.txt
index 3953431..a669a32 100644
--- a/Documentation/git-for-each-ref.txt
+++ b/Documentation/git-for-each-ref.txt
@@ -166,6 +166,11 @@ if::
the value between the %(if:...) and %(then) atoms with the
given string.
+symref::
+ The ref which the given symbolic ref refers to. If not a
+ symbolic ref, nothing is printed. Respects the `:short` and
+ `:strip` options in the same way as `refname` above.
+
In addition to the above, for commit and tag objects, the header
field names (`tree`, `parent`, `object`, `type`, and `tag`) can
be used to specify the value in the header field.
diff --git a/ref-filter.c b/ref-filter.c
index aad537d..f1d27b5 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -176,6 +176,16 @@ static void objectname_atom_parser(struct used_atom *atom, const char *arg)
die(_("unrecognized %%(objectname) argument: %s"), arg);
}
+static void symref_atom_parser(struct used_atom *atom, const char *arg)
+{
+ return refname_atom_parser_internal(&atom->u.refname, arg, atom->name);
+}
+
+static void refname_atom_parser(struct used_atom *atom, const char *arg)
+{
+ return refname_atom_parser_internal(&atom->u.refname, arg, atom->name);
+}
+
static align_type parse_align_position(const char *s)
{
if (!strcmp(s, "right"))
@@ -244,7 +254,7 @@ static struct {
cmp_type cmp_type;
void (*parser)(struct used_atom *atom, const char *arg);
} valid_atom[] = {
- { "refname" },
+ { "refname" , FIELD_STR, refname_atom_parser },
{ "objecttype" },
{ "objectsize", FIELD_ULONG },
{ "objectname", FIELD_STR, objectname_atom_parser },
@@ -273,7 +283,7 @@ static struct {
{ "contents", FIELD_STR, contents_atom_parser },
{ "upstream", FIELD_STR, remote_ref_atom_parser },
{ "push", FIELD_STR, remote_ref_atom_parser },
- { "symref" },
+ { "symref", FIELD_STR, symref_atom_parser },
{ "flag" },
{ "HEAD" },
{ "color", FIELD_STR, color_atom_parser },
@@ -1058,21 +1068,16 @@ static inline char *copy_advance(char *dst, const char *src)
return dst;
}
-static const char *strip_ref_components(const char *refname, const char *nr_arg)
+static const char *strip_ref_components(const char *refname, unsigned int len)
{
- char *end;
- long nr = strtol(nr_arg, &end, 10);
- long remaining = nr;
+ long remaining = len;
const char *start = refname;
- if (nr < 1 || *end != '\0')
- die(_(":strip= requires a positive integer argument"));
-
while (remaining) {
switch (*start++) {
case '\0':
- die(_("ref '%s' does not have %ld components to :strip"),
- refname, nr);
+ die(_("ref '%s' does not have %ud components to :strip"),
+ refname, len);
case '/':
remaining--;
break;
@@ -1081,6 +1086,16 @@ static const char *strip_ref_components(const char *refname, const char *nr_arg)
return start;
}
+static const char *show_ref(struct refname_atom *atom, const char *refname)
+{
+ if (atom->option == R_SHORT)
+ return shorten_unambiguous_ref(refname, warn_ambiguous_refs);
+ else if (atom->option == R_STRIP)
+ return strip_ref_components(refname, atom->strip);
+ else
+ return refname;
+}
+
static void fill_remote_ref_details(struct used_atom *atom, const char *refname,
struct branch *branch, const char **s)
{
@@ -1153,6 +1168,21 @@ char *get_head_description(void)
return strbuf_detach(&desc, NULL);
}
+static const char *get_symref(struct used_atom *atom, struct ref_array_item *ref)
+{
+ if (!ref->symref)
+ return "";
+ else
+ return show_ref(&atom->u.refname, ref->symref);
+}
+
+static const char *get_refname(struct used_atom *atom, struct ref_array_item *ref)
+{
+ if (ref->kind & FILTER_REFS_DETACHED_HEAD)
+ return get_head_description();
+ return show_ref(&atom->u.refname, ref->refname);
+}
+
/*
* Parse the object referred by ref, and grab needed value.
*/
@@ -1181,7 +1211,6 @@ static void populate_value(struct ref_array_item *ref)
struct atom_value *v = &ref->value[i];
int deref = 0;
const char *refname;
- const char *formatp;
struct branch *branch = NULL;
v->handler = append_atom;
@@ -1192,12 +1221,10 @@ static void populate_value(struct ref_array_item *ref)
name++;
}
- if (starts_with(name, "refname")) {
- refname = ref->refname;
- if (ref->kind & FILTER_REFS_DETACHED_HEAD)
- refname = get_head_description();
- } else if (starts_with(name, "symref"))
- refname = ref->symref ? ref->symref : "";
+ if (starts_with(name, "refname"))
+ refname = get_refname(atom, ref);
+ else if (starts_with(name, "symref"))
+ refname = get_symref(atom, ref);
else if (starts_with(name, "upstream")) {
const char *branch_name;
/* only local branches may have an upstream */
@@ -1273,21 +1300,6 @@ static void populate_value(struct ref_array_item *ref)
} else
continue;
- formatp = strchr(name, ':');
- if (formatp) {
- const char *arg;
-
- formatp++;
- if (!strcmp(formatp, "short"))
- refname = shorten_unambiguous_ref(refname,
- warn_ambiguous_refs);
- else if (skip_prefix(formatp, "strip=", &arg))
- refname = strip_ref_components(refname, arg);
- else
- die(_("unknown %.*s format %s"),
- (int)(formatp - name), name, formatp);
- }
-
if (!deref)
v->s = refname;
else
diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh
index b06ea1c..3d28234 100755
--- a/t/t6300-for-each-ref.sh
+++ b/t/t6300-for-each-ref.sh
@@ -589,4 +589,13 @@ test_expect_success 'Verify usage of %(symref:short) atom' '
test_cmp expected actual
'
+cat >expected <<EOF
+master
+EOF
+
+test_expect_success 'Verify usage of %(symref:strip) atom' '
+ git for-each-ref --format="%(symref:strip=2)" refs/heads/sym > actual &&
+ test_cmp expected actual
+'
+
test_done
--
2.10.2
^ permalink raw reply related
* [PATCH v7 12/17] ref-filter: make remote_ref_atom_parser() use refname_atom_parser_internal()
From: Karthik Nayak @ 2016-11-08 20:12 UTC (permalink / raw)
To: git; +Cc: jacob.keller, Karthik Nayak, Karthik Nayak
In-Reply-To: <20161108201211.25213-1-Karthik.188@gmail.com>
From: Karthik Nayak <karthik.188@gmail.com>
Use the recently introduced refname_atom_parser_internal() within
remote_ref_atom_parser(), this provides a common base for all the ref
printing atoms, allowing %(upstream) and %(push) to also use the
':strip' option.
The atoms '%(push)' and '%(upstream)' will retain the ':track' and
':trackshort' atom modifiers to themselves as they have no meaning in
context to the '%(refname)' and '%(symref)' atoms.
Update the documentation and tests to reflect the same.
Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
---
Documentation/git-for-each-ref.txt | 27 ++++++++++++++-------------
ref-filter.c | 26 +++++++++++++++-----------
t/t6300-for-each-ref.sh | 2 ++
3 files changed, 31 insertions(+), 24 deletions(-)
diff --git a/Documentation/git-for-each-ref.txt b/Documentation/git-for-each-ref.txt
index a669a32..600b703 100644
--- a/Documentation/git-for-each-ref.txt
+++ b/Documentation/git-for-each-ref.txt
@@ -114,21 +114,22 @@ objectname::
upstream::
The name of a local ref which can be considered ``upstream''
- from the displayed ref. Respects `:short` in the same way as
- `refname` above. Additionally respects `:track` to show
- "[ahead N, behind M]" and `:trackshort` to show the terse
- version: ">" (ahead), "<" (behind), "<>" (ahead and behind),
- or "=" (in sync). `:track` also prints "[gone]" whenever
- unknown upstream ref is encountered. Append `:track,nobracket`
- to show tracking information without brackets (i.e "ahead N,
- behind M"). Has no effect if the ref does not have tracking
- information associated with it.
+ from the displayed ref. Respects `:short` and `:strip` in the
+ same way as `refname` above. Additionally respects `:track`
+ to show "[ahead N, behind M]" and `:trackshort` to show the
+ terse version: ">" (ahead), "<" (behind), "<>" (ahead and
+ behind), or "=" (in sync). `:track` also prints "[gone]"
+ whenever unknown upstream ref is encountered. Append
+ `:track,nobracket` to show tracking information without
+ brackets (i.e "ahead N, behind M"). Has no effect if the ref
+ does not have tracking information associated with it.
push::
- The name of a local ref which represents the `@{push}` location
- for the displayed ref. Respects `:short`, `:track`, and
- `:trackshort` options as `upstream` does. Produces an empty
- string if no `@{push}` ref is configured.
+ The name of a local ref which represents the `@{push}`
+ location for the displayed ref. Respects `:short`, `:strip`,
+ `:track`, and `:trackshort` options as `upstream`
+ does. Produces an empty string if no `@{push}` ref is
+ configured.
HEAD::
'*' if HEAD matches current ref (the checked out branch), ' '
diff --git a/ref-filter.c b/ref-filter.c
index f1d27b5..7d3d3a6 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -52,7 +52,8 @@ static struct used_atom {
char color[COLOR_MAXLEN];
struct align align;
struct {
- enum { RR_NORMAL, RR_SHORTEN, RR_TRACK, RR_TRACKSHORT } option;
+ enum { RR_REF, RR_TRACK, RR_TRACKSHORT } option;
+ struct refname_atom refname;
unsigned int nobracket: 1;
} remote_ref;
struct {
@@ -102,7 +103,9 @@ static void remote_ref_atom_parser(struct used_atom *atom, const char *arg)
int i;
if (!arg) {
- atom->u.remote_ref.option = RR_NORMAL;
+ atom->u.remote_ref.option = RR_REF;
+ refname_atom_parser_internal(&atom->u.remote_ref.refname,
+ arg, atom->name);
return;
}
@@ -112,16 +115,17 @@ static void remote_ref_atom_parser(struct used_atom *atom, const char *arg)
for (i = 0; i < params.nr; i++) {
const char *s = params.items[i].string;
- if (!strcmp(s, "short"))
- atom->u.remote_ref.option = RR_SHORTEN;
- else if (!strcmp(s, "track"))
+ if (!strcmp(s, "track"))
atom->u.remote_ref.option = RR_TRACK;
else if (!strcmp(s, "trackshort"))
atom->u.remote_ref.option = RR_TRACKSHORT;
else if (!strcmp(s, "nobracket"))
atom->u.remote_ref.nobracket = 1;
- else
- die(_("unrecognized format: %%(%s)"), atom->name);
+ else {
+ atom->u.remote_ref.option = RR_REF;
+ refname_atom_parser_internal(&atom->u.remote_ref.refname,
+ arg, atom->name);
+ }
}
string_list_clear(¶ms, 0);
@@ -1100,8 +1104,8 @@ static void fill_remote_ref_details(struct used_atom *atom, const char *refname,
struct branch *branch, const char **s)
{
int num_ours, num_theirs;
- if (atom->u.remote_ref.option == RR_SHORTEN)
- *s = shorten_unambiguous_ref(refname, warn_ambiguous_refs);
+ if (atom->u.remote_ref.option == RR_REF)
+ *s = show_ref(&atom->u.remote_ref.refname, refname);
else if (atom->u.remote_ref.option == RR_TRACK) {
if (stat_tracking_info(branch, &num_ours,
&num_theirs, NULL)) {
@@ -1133,8 +1137,8 @@ static void fill_remote_ref_details(struct used_atom *atom, const char *refname,
*s = ">";
else
*s = "<>";
- } else /* RR_NORMAL */
- *s = refname;
+ } else
+ die("BUG: unhandled RR_* enum");
}
char *get_head_description(void)
diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh
index 3d28234..7ca0a12 100755
--- a/t/t6300-for-each-ref.sh
+++ b/t/t6300-for-each-ref.sh
@@ -55,8 +55,10 @@ test_atom head refname:strip=1 heads/master
test_atom head refname:strip=2 master
test_atom head upstream refs/remotes/origin/master
test_atom head upstream:short origin/master
+test_atom head upstream:strip=2 origin/master
test_atom head push refs/remotes/myfork/master
test_atom head push:short myfork/master
+test_atom head push:strip=1 remotes/myfork/master
test_atom head objecttype commit
test_atom head objectsize 171
test_atom head objectname $(git rev-parse refs/heads/master)
--
2.10.2
^ permalink raw reply related
* [PATCH v7 14/17] ref-filter: allow porcelain to translate messages in the output
From: Karthik Nayak @ 2016-11-08 20:12 UTC (permalink / raw)
To: git; +Cc: jacob.keller, Karthik Nayak
In-Reply-To: <20161108201211.25213-1-Karthik.188@gmail.com>
From: Karthik Nayak <karthik.188@gmail.com>
Introduce setup_ref_filter_porcelain_msg() so that the messages used in
the atom %(upstream:track) can be translated if needed. This is needed
as we port branch.c to use ref-filter's printing API's.
Written-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
---
ref-filter.c | 28 ++++++++++++++++++++++++----
ref-filter.h | 2 ++
2 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/ref-filter.c b/ref-filter.c
index b47b900..944671a 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -15,6 +15,26 @@
#include "version.h"
#include "wt-status.h"
+static struct ref_msg {
+ const char *gone;
+ const char *ahead;
+ const char *behind;
+ const char *ahead_behind;
+} msgs = {
+ "gone",
+ "ahead %d",
+ "behind %d",
+ "ahead %d, behind %d"
+};
+
+void setup_ref_filter_porcelain_msg(void)
+{
+ msgs.gone = _("gone");
+ msgs.ahead = _("ahead %d");
+ msgs.behind = _("behind %d");
+ msgs.ahead_behind = _("ahead %d, behind %d");
+}
+
typedef enum { FIELD_STR, FIELD_ULONG, FIELD_TIME } cmp_type;
struct align {
@@ -1130,15 +1150,15 @@ static void fill_remote_ref_details(struct used_atom *atom, const char *refname,
else if (atom->u.remote_ref.option == RR_TRACK) {
if (stat_tracking_info(branch, &num_ours,
&num_theirs, NULL)) {
- *s = xstrdup("gone");
+ *s = xstrdup(msgs.gone);
} else if (!num_ours && !num_theirs)
*s = "";
else if (!num_ours)
- *s = xstrfmt("behind %d", num_theirs);
+ *s = xstrfmt(msgs.behind, num_theirs);
else if (!num_theirs)
- *s = xstrfmt("ahead %d", num_ours);
+ *s = xstrfmt(msgs.ahead, num_ours);
else
- *s = xstrfmt("ahead %d, behind %d",
+ *s = xstrfmt(msgs.ahead_behind,
num_ours, num_theirs);
if (!atom->u.remote_ref.nobracket && *s[0]) {
const char *to_free = *s;
diff --git a/ref-filter.h b/ref-filter.h
index 0014b92..da17145 100644
--- a/ref-filter.h
+++ b/ref-filter.h
@@ -111,5 +111,7 @@ struct ref_sorting *ref_default_sorting(void);
int parse_opt_merge_filter(const struct option *opt, const char *arg, int unset);
/* Get the current HEAD's description */
char *get_head_description(void);
+/* Set up translated strings in the output. */
+void setup_ref_filter_porcelain_msg(void);
#endif /* REF_FILTER_H */
--
2.10.2
^ permalink raw reply related
* [PATCH v7 13/17] ref-filter: add `:dir` and `:base` options for ref printing atoms
From: Karthik Nayak @ 2016-11-08 20:12 UTC (permalink / raw)
To: git; +Cc: jacob.keller, Karthik Nayak, Karthik Nayak
In-Reply-To: <20161108201211.25213-1-Karthik.188@gmail.com>
From: Karthik Nayak <karthik.188@gmail.com>
Add the options `:dir` and `:base` to all ref printing ('%(refname)',
'%(symref)', '%(push)' and '%(upstream)') atoms. The `:dir` option gives
the directory (the part after $GIT_DIR/) of the ref without the
refname. The `:base` option gives the base directory of the given
ref (i.e. the directory following $GIT_DIR/refs/).
Add tests and documentation for the same.
Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
---
Documentation/git-for-each-ref.txt | 34 +++++++++++++++++++---------------
ref-filter.c | 29 +++++++++++++++++++++++++----
t/t6300-for-each-ref.sh | 24 ++++++++++++++++++++++++
3 files changed, 68 insertions(+), 19 deletions(-)
diff --git a/Documentation/git-for-each-ref.txt b/Documentation/git-for-each-ref.txt
index 600b703..f4ad297 100644
--- a/Documentation/git-for-each-ref.txt
+++ b/Documentation/git-for-each-ref.txt
@@ -96,7 +96,9 @@ refname::
slash-separated path components from the front of the refname
(e.g., `%(refname:strip=2)` turns `refs/tags/foo` into `foo`.
`<N>` must be a positive integer. If a displayed ref has fewer
- components than `<N>`, the command aborts with an error.
+ components than `<N>`, the command aborts with an error. For the base
+ directory of the ref (i.e. foo in refs/foo/bar/boz) append
+ `:base`. For the entire directory path append `:dir`.
objecttype::
The type of the object (`blob`, `tree`, `commit`, `tag`).
@@ -114,22 +116,23 @@ objectname::
upstream::
The name of a local ref which can be considered ``upstream''
- from the displayed ref. Respects `:short` and `:strip` in the
- same way as `refname` above. Additionally respects `:track`
- to show "[ahead N, behind M]" and `:trackshort` to show the
- terse version: ">" (ahead), "<" (behind), "<>" (ahead and
- behind), or "=" (in sync). `:track` also prints "[gone]"
- whenever unknown upstream ref is encountered. Append
- `:track,nobracket` to show tracking information without
- brackets (i.e "ahead N, behind M"). Has no effect if the ref
- does not have tracking information associated with it.
+ from the displayed ref. Respects `:short`, `:strip`, `:base`
+ and `:dir` in the same way as `refname` above. Additionally
+ respects `:track` to show "[ahead N, behind M]" and
+ `:trackshort` to show the terse version: ">" (ahead), "<"
+ (behind), "<>" (ahead and behind), or "=" (in sync). `:track`
+ also prints "[gone]" whenever unknown upstream ref is
+ encountered. Append `:track,nobracket` to show tracking
+ information without brackets (i.e "ahead N, behind M"). Has
+ no effect if the ref does not have tracking information
+ associated with it.
push::
The name of a local ref which represents the `@{push}`
location for the displayed ref. Respects `:short`, `:strip`,
- `:track`, and `:trackshort` options as `upstream`
- does. Produces an empty string if no `@{push}` ref is
- configured.
+ `:track`, `:trackshort`, `:base` and `:dir` options as
+ `upstream` does. Produces an empty string if no `@{push}` ref
+ is configured.
HEAD::
'*' if HEAD matches current ref (the checked out branch), ' '
@@ -169,8 +172,9 @@ if::
symref::
The ref which the given symbolic ref refers to. If not a
- symbolic ref, nothing is printed. Respects the `:short` and
- `:strip` options in the same way as `refname` above.
+ symbolic ref, nothing is printed. Respects the `:short`,
+ `:strip`, `:base` and `:dir` options in the same way as
+ `refname` above.
In addition to the above, for commit and tag objects, the header
field names (`tree`, `parent`, `object`, `type`, and `tag`) can
diff --git a/ref-filter.c b/ref-filter.c
index 7d3d3a6..b47b900 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -31,7 +31,7 @@ struct if_then_else {
};
struct refname_atom {
- enum { R_NORMAL, R_SHORT, R_STRIP } option;
+ enum { R_BASE, R_DIR, R_NORMAL, R_SHORT, R_STRIP } option;
unsigned int strip;
};
@@ -93,7 +93,11 @@ static void refname_atom_parser_internal(struct refname_atom *atom,
atom->option = R_STRIP;
if (strtoul_ui(arg, 10, &atom->strip) || atom->strip <= 0)
die(_("positive value expected refname:strip=%s"), arg);
- } else
+ } else if (!strcmp(arg, "dir"))
+ atom->option = R_DIR;
+ else if (!strcmp(arg, "base"))
+ atom->option = R_BASE;
+ else
die(_("unrecognized %%(%s) argument: %s"), name, arg);
}
@@ -252,7 +256,6 @@ static void if_atom_parser(struct used_atom *atom, const char *arg)
die(_("unrecognized %%(if) argument: %s"), arg);
}
-
static struct {
const char *name;
cmp_type cmp_type;
@@ -1096,7 +1099,25 @@ static const char *show_ref(struct refname_atom *atom, const char *refname)
return shorten_unambiguous_ref(refname, warn_ambiguous_refs);
else if (atom->option == R_STRIP)
return strip_ref_components(refname, atom->strip);
- else
+ else if (atom->option == R_BASE) {
+ const char *sp, *ep;
+
+ if (skip_prefix(refname, "refs/", &sp)) {
+ ep = strchr(sp, '/');
+ if (!ep)
+ return "";
+ return xstrndup(sp, ep - sp);
+ }
+ return "";
+ } else if (atom->option == R_DIR) {
+ const char *sp, *ep;
+
+ sp = refname;
+ ep = strrchr(sp, '/');
+ if (!ep)
+ return "";
+ return xstrndup(sp, ep - sp);
+ } else
return refname;
}
diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh
index 7ca0a12..8ff6568 100755
--- a/t/t6300-for-each-ref.sh
+++ b/t/t6300-for-each-ref.sh
@@ -53,12 +53,18 @@ test_atom head refname refs/heads/master
test_atom head refname:short master
test_atom head refname:strip=1 heads/master
test_atom head refname:strip=2 master
+test_atom head refname:dir refs/heads
+test_atom head refname:base heads
test_atom head upstream refs/remotes/origin/master
test_atom head upstream:short origin/master
test_atom head upstream:strip=2 origin/master
+test_atom head upstream:dir refs/remotes/origin
+test_atom head upstream:base remotes
test_atom head push refs/remotes/myfork/master
test_atom head push:short myfork/master
test_atom head push:strip=1 remotes/myfork/master
+test_atom head push:dir refs/remotes/myfork
+test_atom head push:base remotes
test_atom head objecttype commit
test_atom head objectsize 171
test_atom head objectname $(git rev-parse refs/heads/master)
@@ -600,4 +606,22 @@ test_expect_success 'Verify usage of %(symref:strip) atom' '
test_cmp expected actual
'
+cat >expected <<EOF
+refs/heads
+EOF
+
+test_expect_success 'Verify usage of %(symref:dir) atom' '
+ git for-each-ref --format="%(symref:dir)" refs/heads/sym > actual &&
+ test_cmp expected actual
+'
+
+cat >expected <<EOF
+heads
+EOF
+
+test_expect_success 'Verify usage of %(symref:base) atom' '
+ git for-each-ref --format="%(symref:base)" refs/heads/sym > actual &&
+ test_cmp expected actual
+'
+
test_done
--
2.10.2
^ permalink raw reply related
* [PATCH v7 16/17] branch: use ref-filter printing APIs
From: Karthik Nayak @ 2016-11-08 20:12 UTC (permalink / raw)
To: git; +Cc: jacob.keller, Karthik Nayak
In-Reply-To: <20161108201211.25213-1-Karthik.188@gmail.com>
From: Karthik Nayak <karthik.188@gmail.com>
Port branch.c to use ref-filter APIs for printing. This clears out
most of the code used in branch.c for printing and replaces them with
calls made to the ref-filter library.
Introduce build_format() which gets the format required for printing
of refs. Make amendments to print_ref_list() to reflect these changes.
Change calc_maxwidth() to also account for the length of HEAD ref, by
calling ref-filter:get_head_discription().
Also change the test in t6040 to reflect the changes.
Before this patch, all cross-prefix symrefs weren't shortened. Since
we're using ref-filter APIs, we shorten all symrefs by default. We also
allow the user to change the format if needed with the introduction of
the '--format' option in the next patch.
Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
---
builtin/branch.c | 234 ++++++++++++++---------------------------------
t/t3203-branch-output.sh | 2 +-
t/t6040-tracking-info.sh | 2 +-
3 files changed, 70 insertions(+), 168 deletions(-)
diff --git a/builtin/branch.c b/builtin/branch.c
index dead2b8..a19e05d 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -36,12 +36,12 @@ static unsigned char head_sha1[20];
static int branch_use_color = -1;
static char branch_colors[][COLOR_MAXLEN] = {
- GIT_COLOR_RESET,
- GIT_COLOR_NORMAL, /* PLAIN */
- GIT_COLOR_RED, /* REMOTE */
- GIT_COLOR_NORMAL, /* LOCAL */
- GIT_COLOR_GREEN, /* CURRENT */
- GIT_COLOR_BLUE, /* UPSTREAM */
+ "%(color:reset)",
+ "%(color:reset)", /* PLAIN */
+ "%(color:red)", /* REMOTE */
+ "%(color:reset)", /* LOCAL */
+ "%(color:green)", /* CURRENT */
+ "%(color:blue)", /* UPSTREAM */
};
enum color_branch {
BRANCH_COLOR_RESET = 0,
@@ -280,162 +280,6 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
return(ret);
}
-static void fill_tracking_info(struct strbuf *stat, const char *branch_name,
- int show_upstream_ref)
-{
- int ours, theirs;
- char *ref = NULL;
- struct branch *branch = branch_get(branch_name);
- const char *upstream;
- struct strbuf fancy = STRBUF_INIT;
- int upstream_is_gone = 0;
- int added_decoration = 1;
-
- if (stat_tracking_info(branch, &ours, &theirs, &upstream) < 0) {
- if (!upstream)
- return;
- upstream_is_gone = 1;
- }
-
- if (show_upstream_ref) {
- ref = shorten_unambiguous_ref(upstream, 0);
- if (want_color(branch_use_color))
- strbuf_addf(&fancy, "%s%s%s",
- branch_get_color(BRANCH_COLOR_UPSTREAM),
- ref, branch_get_color(BRANCH_COLOR_RESET));
- else
- strbuf_addstr(&fancy, ref);
- }
-
- if (upstream_is_gone) {
- if (show_upstream_ref)
- strbuf_addf(stat, _("[%s: gone]"), fancy.buf);
- else
- added_decoration = 0;
- } else if (!ours && !theirs) {
- if (show_upstream_ref)
- strbuf_addf(stat, _("[%s]"), fancy.buf);
- else
- added_decoration = 0;
- } else if (!ours) {
- if (show_upstream_ref)
- strbuf_addf(stat, _("[%s: behind %d]"), fancy.buf, theirs);
- else
- strbuf_addf(stat, _("[behind %d]"), theirs);
-
- } else if (!theirs) {
- if (show_upstream_ref)
- strbuf_addf(stat, _("[%s: ahead %d]"), fancy.buf, ours);
- else
- strbuf_addf(stat, _("[ahead %d]"), ours);
- } else {
- if (show_upstream_ref)
- strbuf_addf(stat, _("[%s: ahead %d, behind %d]"),
- fancy.buf, ours, theirs);
- else
- strbuf_addf(stat, _("[ahead %d, behind %d]"),
- ours, theirs);
- }
- strbuf_release(&fancy);
- if (added_decoration)
- strbuf_addch(stat, ' ');
- free(ref);
-}
-
-static void add_verbose_info(struct strbuf *out, struct ref_array_item *item,
- struct ref_filter *filter, const char *refname)
-{
- struct strbuf subject = STRBUF_INIT, stat = STRBUF_INIT;
- const char *sub = _(" **** invalid ref ****");
- struct commit *commit = item->commit;
-
- if (!parse_commit(commit)) {
- pp_commit_easy(CMIT_FMT_ONELINE, commit, &subject);
- sub = subject.buf;
- }
-
- if (item->kind == FILTER_REFS_BRANCHES)
- fill_tracking_info(&stat, refname, filter->verbose > 1);
-
- strbuf_addf(out, " %s %s%s",
- find_unique_abbrev(item->commit->object.oid.hash, filter->abbrev),
- stat.buf, sub);
- strbuf_release(&stat);
- strbuf_release(&subject);
-}
-
-static void format_and_print_ref_item(struct ref_array_item *item, int maxwidth,
- struct ref_filter *filter, const char *remote_prefix)
-{
- char c;
- int current = 0;
- int color;
- struct strbuf out = STRBUF_INIT, name = STRBUF_INIT;
- const char *prefix_to_show = "";
- const char *prefix_to_skip = NULL;
- const char *desc = item->refname;
- char *to_free = NULL;
-
- switch (item->kind) {
- case FILTER_REFS_BRANCHES:
- prefix_to_skip = "refs/heads/";
- skip_prefix(desc, prefix_to_skip, &desc);
- if (!filter->detached && !strcmp(desc, head))
- current = 1;
- else
- color = BRANCH_COLOR_LOCAL;
- break;
- case FILTER_REFS_REMOTES:
- prefix_to_skip = "refs/remotes/";
- skip_prefix(desc, prefix_to_skip, &desc);
- color = BRANCH_COLOR_REMOTE;
- prefix_to_show = remote_prefix;
- break;
- case FILTER_REFS_DETACHED_HEAD:
- desc = to_free = get_head_description();
- current = 1;
- break;
- default:
- color = BRANCH_COLOR_PLAIN;
- break;
- }
-
- c = ' ';
- if (current) {
- c = '*';
- color = BRANCH_COLOR_CURRENT;
- }
-
- strbuf_addf(&name, "%s%s", prefix_to_show, desc);
- if (filter->verbose) {
- int utf8_compensation = strlen(name.buf) - utf8_strwidth(name.buf);
- strbuf_addf(&out, "%c %s%-*s%s", c, branch_get_color(color),
- maxwidth + utf8_compensation, name.buf,
- branch_get_color(BRANCH_COLOR_RESET));
- } else
- strbuf_addf(&out, "%c %s%s%s", c, branch_get_color(color),
- name.buf, branch_get_color(BRANCH_COLOR_RESET));
-
- if (item->symref) {
- const char *symref = item->symref;
- if (prefix_to_skip)
- skip_prefix(symref, prefix_to_skip, &symref);
- strbuf_addf(&out, " -> %s", symref);
- }
- else if (filter->verbose)
- /* " f7c0c00 [ahead 58, behind 197] vcs-svn: drop obj_pool.h" */
- add_verbose_info(&out, item, filter, desc);
- if (column_active(colopts)) {
- assert(!filter->verbose && "--column and --verbose are incompatible");
- string_list_append(&output, out.buf);
- } else {
- printf("%s\n", out.buf);
- }
- strbuf_release(&name);
- strbuf_release(&out);
- free(to_free);
-}
-
static int calc_maxwidth(struct ref_array *refs, int remote_bonus)
{
int i, max = 0;
@@ -446,7 +290,12 @@ static int calc_maxwidth(struct ref_array *refs, int remote_bonus)
skip_prefix(it->refname, "refs/heads/", &desc);
skip_prefix(it->refname, "refs/remotes/", &desc);
- w = utf8_strwidth(desc);
+ if (it->kind == FILTER_REFS_DETACHED_HEAD) {
+ char *head_desc = get_head_description();
+ w = utf8_strwidth(head_desc);
+ free(head_desc);
+ } else
+ w = utf8_strwidth(desc);
if (it->kind == FILTER_REFS_REMOTES)
w += remote_bonus;
@@ -456,12 +305,52 @@ static int calc_maxwidth(struct ref_array *refs, int remote_bonus)
return max;
}
+static char *build_format(struct ref_filter *filter, int maxwidth, const char *remote_prefix)
+{
+ struct strbuf fmt = STRBUF_INIT;
+ struct strbuf local = STRBUF_INIT;
+ struct strbuf remote = STRBUF_INIT;
+
+ strbuf_addf(&fmt, "%%(if)%%(HEAD)%%(then)* %s%%(else) %%(end)", branch_get_color(BRANCH_COLOR_CURRENT));
+
+ if (filter->verbose) {
+ strbuf_addf(&local, "%%(align:%d,left)%%(refname:strip=2)%%(end)", maxwidth);
+ strbuf_addf(&local, "%s", branch_get_color(BRANCH_COLOR_RESET));
+ strbuf_addf(&local, " %%(objectname:short=7) ");
+
+ if (filter->verbose > 1)
+ strbuf_addf(&local, "%%(if)%%(upstream)%%(then)[%s%%(upstream:short)%s%%(if)%%(upstream:track)"
+ "%%(then): %%(upstream:track,nobracket)%%(end)] %%(end)%%(contents:subject)",
+ branch_get_color(BRANCH_COLOR_UPSTREAM), branch_get_color(BRANCH_COLOR_RESET));
+ else
+ strbuf_addf(&local, "%%(if)%%(upstream:track)%%(then)%%(upstream:track) %%(end)%%(contents:subject)");
+
+ strbuf_addf(&remote, "%s%%(align:%d,left)%s%%(refname:strip=2)%%(end)%s%%(if)%%(symref)%%(then) -> %%(symref:short)"
+ "%%(else) %%(objectname:short=7) %%(contents:subject)%%(end)",
+ branch_get_color(BRANCH_COLOR_REMOTE), maxwidth,
+ remote_prefix, branch_get_color(BRANCH_COLOR_RESET));
+ } else {
+ strbuf_addf(&local, "%%(refname:strip=2)%s%%(if)%%(symref)%%(then) -> %%(symref:short)%%(end)",
+ branch_get_color(BRANCH_COLOR_RESET));
+ strbuf_addf(&remote, "%s%s%%(refname:strip=2)%s%%(if)%%(symref)%%(then) -> %%(symref:short)%%(end)",
+ branch_get_color(BRANCH_COLOR_REMOTE), remote_prefix, branch_get_color(BRANCH_COLOR_RESET));
+ }
+
+ strbuf_addf(&fmt, "%%(if:notequals=remotes)%%(refname:base)%%(then)%s%%(else)%s%%(end)", local.buf, remote.buf);
+
+ strbuf_release(&local);
+ strbuf_release(&remote);
+ return strbuf_detach(&fmt, NULL);
+}
+
static void print_ref_list(struct ref_filter *filter, struct ref_sorting *sorting)
{
int i;
struct ref_array array;
int maxwidth = 0;
const char *remote_prefix = "";
+ struct strbuf out = STRBUF_INIT;
+ char *format;
/*
* If we are listing more than just remote branches,
@@ -473,12 +362,14 @@ static void print_ref_list(struct ref_filter *filter, struct ref_sorting *sortin
memset(&array, 0, sizeof(array));
- verify_ref_format("%(refname)%(symref)");
filter_refs(&array, filter, filter->kind | FILTER_REFS_INCLUDE_BROKEN);
if (filter->verbose)
maxwidth = calc_maxwidth(&array, strlen(remote_prefix));
+ format = build_format(filter, maxwidth, remote_prefix);
+ verify_ref_format(format);
+
/*
* If no sorting parameter is given then we default to sorting
* by 'refname'. This would give us an alphabetically sorted
@@ -490,10 +381,21 @@ static void print_ref_list(struct ref_filter *filter, struct ref_sorting *sortin
sorting = ref_default_sorting();
ref_array_sort(sorting, &array);
- for (i = 0; i < array.nr; i++)
- format_and_print_ref_item(array.items[i], maxwidth, filter, remote_prefix);
+ for (i = 0; i < array.nr; i++) {
+ format_ref_array_item(array.items[i], format, 0, &out);
+ if (column_active(colopts)) {
+ assert(!filter->verbose && "--column and --verbose are incompatible");
+ /* format to a string_list to let print_columns() do its job */
+ string_list_append(&output, out.buf);
+ } else {
+ fwrite(out.buf, 1, out.len, stdout);
+ putchar('\n');
+ }
+ strbuf_release(&out);
+ }
ref_array_clear(&array);
+ free(format);
}
static void reject_rebase_or_bisect_branch(const char *target)
diff --git a/t/t3203-branch-output.sh b/t/t3203-branch-output.sh
index c6a3ccb..980c732 100755
--- a/t/t3203-branch-output.sh
+++ b/t/t3203-branch-output.sh
@@ -189,7 +189,7 @@ test_expect_success 'local-branch symrefs shortened properly' '
git symbolic-ref refs/heads/ref-to-remote refs/remotes/origin/branch-one &&
cat >expect <<-\EOF &&
ref-to-branch -> branch-one
- ref-to-remote -> refs/remotes/origin/branch-one
+ ref-to-remote -> origin/branch-one
EOF
git branch >actual.raw &&
grep ref-to <actual.raw >actual &&
diff --git a/t/t6040-tracking-info.sh b/t/t6040-tracking-info.sh
index 3d5c238..97a0765 100755
--- a/t/t6040-tracking-info.sh
+++ b/t/t6040-tracking-info.sh
@@ -44,7 +44,7 @@ b1 [ahead 1, behind 1] d
b2 [ahead 1, behind 1] d
b3 [behind 1] b
b4 [ahead 2] f
-b5 g
+b5 [gone] g
b6 c
EOF
--
2.10.2
^ permalink raw reply related
* [PATCH v7 15/17] branch, tag: use porcelain output
From: Karthik Nayak @ 2016-11-08 20:12 UTC (permalink / raw)
To: git; +Cc: jacob.keller, Karthik Nayak
In-Reply-To: <20161108201211.25213-1-Karthik.188@gmail.com>
From: Karthik Nayak <karthik.188@gmail.com>
Call ref-filter's setup_ref_filter_porcelain_msg() to enable
translated messages for the %(upstream:tack) atom. Although branch.c
doesn't currently use ref-filter's printing API's, this will ensure
that when it does in the future patches, we do not need to worry about
translation.
Written-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
---
builtin/branch.c | 2 ++
builtin/tag.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/builtin/branch.c b/builtin/branch.c
index be9773a..dead2b8 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -656,6 +656,8 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
OPT_END(),
};
+ setup_ref_filter_porcelain_msg();
+
memset(&filter, 0, sizeof(filter));
filter.kind = FILTER_REFS_BRANCHES;
filter.abbrev = -1;
diff --git a/builtin/tag.c b/builtin/tag.c
index 50e4ae5..a00e9a7 100644
--- a/builtin/tag.c
+++ b/builtin/tag.c
@@ -373,6 +373,8 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
OPT_END()
};
+ setup_ref_filter_porcelain_msg();
+
git_config(git_tag_config, sorting_tail);
memset(&opt, 0, sizeof(opt));
--
2.10.2
^ permalink raw reply related
* [PATCH v7 17/17] branch: implement '--format' option
From: Karthik Nayak @ 2016-11-08 20:12 UTC (permalink / raw)
To: git; +Cc: jacob.keller, Karthik Nayak
In-Reply-To: <20161108201211.25213-1-Karthik.188@gmail.com>
From: Karthik Nayak <karthik.188@gmail.com>
Implement the '--format' option provided by 'ref-filter'. This lets the
user list branches as per desired format similar to the implementation
in 'git for-each-ref'.
Add tests and documentation for the same.
Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
---
Documentation/git-branch.txt | 7 ++++++-
builtin/branch.c | 14 +++++++++-----
t/t3203-branch-output.sh | 14 ++++++++++++++
3 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt
index 1fe7344..e5b6f31 100644
--- a/Documentation/git-branch.txt
+++ b/Documentation/git-branch.txt
@@ -12,7 +12,7 @@ SYNOPSIS
[--list] [-v [--abbrev=<length> | --no-abbrev]]
[--column[=<options>] | --no-column]
[(--merged | --no-merged | --contains) [<commit>]] [--sort=<key>]
- [--points-at <object>] [<pattern>...]
+ [--points-at <object>] [--format=<format>] [<pattern>...]
'git branch' [--set-upstream | --track | --no-track] [-l] [-f] <branchname> [<start-point>]
'git branch' (--set-upstream-to=<upstream> | -u <upstream>) [<branchname>]
'git branch' --unset-upstream [<branchname>]
@@ -246,6 +246,11 @@ start-point is either a local or remote-tracking branch.
--points-at <object>::
Only list branches of the given object.
+--format <format>::
+ A string that interpolates `%(fieldname)` from the object
+ pointed at by a ref being shown. The format is the same as
+ that of linkgit:git-for-each-ref[1].
+
Examples
--------
diff --git a/builtin/branch.c b/builtin/branch.c
index a19e05d..acadb99 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -28,6 +28,7 @@ static const char * const builtin_branch_usage[] = {
N_("git branch [<options>] [-r] (-d | -D) <branch-name>..."),
N_("git branch [<options>] (-m | -M) [<old-branch>] <new-branch>"),
N_("git branch [<options>] [-r | -a] [--points-at]"),
+ N_("git branch [<options>] [-r | -a] [--format]"),
NULL
};
@@ -343,14 +344,14 @@ static char *build_format(struct ref_filter *filter, int maxwidth, const char *r
return strbuf_detach(&fmt, NULL);
}
-static void print_ref_list(struct ref_filter *filter, struct ref_sorting *sorting)
+static void print_ref_list(struct ref_filter *filter, struct ref_sorting *sorting, const char *format)
{
int i;
struct ref_array array;
int maxwidth = 0;
const char *remote_prefix = "";
struct strbuf out = STRBUF_INIT;
- char *format;
+ char *to_free = NULL;
/*
* If we are listing more than just remote branches,
@@ -367,7 +368,8 @@ static void print_ref_list(struct ref_filter *filter, struct ref_sorting *sortin
if (filter->verbose)
maxwidth = calc_maxwidth(&array, strlen(remote_prefix));
- format = build_format(filter, maxwidth, remote_prefix);
+ if (!format)
+ format = to_free = build_format(filter, maxwidth, remote_prefix);
verify_ref_format(format);
/*
@@ -395,7 +397,7 @@ static void print_ref_list(struct ref_filter *filter, struct ref_sorting *sortin
}
ref_array_clear(&array);
- free(format);
+ free(to_free);
}
static void reject_rebase_or_bisect_branch(const char *target)
@@ -515,6 +517,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
enum branch_track track;
struct ref_filter filter;
static struct ref_sorting *sorting = NULL, **sorting_tail = &sorting;
+ const char *format = NULL;
struct option options[] = {
OPT_GROUP(N_("Generic options")),
@@ -555,6 +558,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
OPTION_CALLBACK, 0, "points-at", &filter.points_at, N_("object"),
N_("print only branches of the object"), 0, parse_opt_object_name
},
+ OPT_STRING( 0 , "format", &format, N_("format"), N_("format to use for the output")),
OPT_END(),
};
@@ -615,7 +619,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
if ((filter.kind & FILTER_REFS_BRANCHES) && filter.detached)
filter.kind |= FILTER_REFS_DETACHED_HEAD;
filter.name_patterns = argv;
- print_ref_list(&filter, sorting);
+ print_ref_list(&filter, sorting, format);
print_columns(&output, colopts, NULL);
string_list_clear(&output, 0);
return 0;
diff --git a/t/t3203-branch-output.sh b/t/t3203-branch-output.sh
index 980c732..d8edaf2 100755
--- a/t/t3203-branch-output.sh
+++ b/t/t3203-branch-output.sh
@@ -196,4 +196,18 @@ test_expect_success 'local-branch symrefs shortened properly' '
test_cmp expect actual
'
+test_expect_success 'git branch --format option' '
+ cat >expect <<-\EOF &&
+ Refname is (HEAD detached from fromtag)
+ Refname is refs/heads/ambiguous
+ Refname is refs/heads/branch-one
+ Refname is refs/heads/branch-two
+ Refname is refs/heads/master
+ Refname is refs/heads/ref-to-branch
+ Refname is refs/heads/ref-to-remote
+ EOF
+ git branch --format="Refname is %(refname)" >actual &&
+ test_cmp expect actual
+'
+
test_done
--
2.10.2
^ permalink raw reply related
* Re: svc_xprt_put is no longer BH-safe
From: Chuck Lever @ 2016-11-08 20:13 UTC (permalink / raw)
To: J. Bruce Fields; +Cc: Linux NFS Mailing List
In-Reply-To: <20161108200339.GA26589@fieldses.org>
> On Nov 8, 2016, at 3:03 PM, J. Bruce Fields <bfields@fieldses.org> wrote:
>
> On Sat, Oct 29, 2016 at 12:21:03PM -0400, Chuck Lever wrote:
>> Hi Bruce-
>
> Sorry for the slow response!
>
> ...
>> In commit 39a9beab5acb83176e8b9a4f0778749a09341f1f ('rpc: share one xps between
>> all backchannels') you added:
>>
>> diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
>> index f5572e3..4f01f63 100644
>> --- a/net/sunrpc/svc_xprt.c
>> +++ b/net/sunrpc/svc_xprt.c
>> @@ -136,6 +136,8 @@ static void svc_xprt_free(struct kref *kref)
>> /* See comment on corresponding get in xs_setup_bc_tcp(): */
>> if (xprt->xpt_bc_xprt)
>> xprt_put(xprt->xpt_bc_xprt);
>> + if (xprt->xpt_bc_xps)
>> + xprt_switch_put(xprt->xpt_bc_xps);
>> xprt->xpt_ops->xpo_free(xprt);
>> module_put(owner);
>> }
>>
>> svc_xprt_free() is invoked by svc_xprt_put(). svc_xprt_put() is called
>> from svc_rdma in soft IRQ context (eg. svc_rdma_wc_receive).
>
> Is that necessary? I wonder why the svcrdma code seems to be taking so
> many of its own references on svc_xprts.
The idea is to keep the xprt around while Work Requests (I/O) are running,
so that the xprt is guaranteed to be there during work completions. The
completion handlers (where svc_xprt_put is often invoked) run in soft IRQ
context.
It's simple to change completions to use a Work Queue instead, but testing
so far shows that will result in a performance loss. I'm still studying it.
Is there another way to keep the xprt's ref count boosted while I/O is
going on?
>> However, xprt_switch_put() takes a spin lock (xps_lock) which is locked
>> everywhere without disabling BHs.
>>
>> It looks to me like 39a9beab5acb makes svc_xprt_put() no longer BH-safe?
>> Not sure if svc_xprt_put() was intended to be BH-safe beforehand.
>>
>> Maybe xprt_switch_put() could be invoked in ->xpo_free, but that seems
>> like a temporary solution.
>
> Since xpo_free is also called from svc_xprt_put that doesn't sound like
> it would change anything. Or do we not trunk over RDMA for some reason?
It's quite desirable to trunk NFS/RDMA on multiple connections, and it
should work just like it does for TCP, but so far it's not been tested.
--
Chuck Lever
^ permalink raw reply
* Re: [PATCH v6 0/5] Functional dependencies between devices
From: Luis R. Rodriguez @ 2016-11-08 20:14 UTC (permalink / raw)
To: Marek Szyprowski
Cc: Luis R. Rodriguez, Greg Kroah-Hartman, Rafael J. Wysocki,
Linux PM list, Alan Stern, Linux Kernel Mailing List,
Tomeu Vizoso, Mark Brown, Lukas Wunner, Kevin Hilman, Ulf Hansson,
Joerg Roedel, Jiri Kosina, Jiri Slaby, Andrzej Hajda,
Laurent Pinchart, Lars-Peter Clausen, Grant Likely
In-Reply-To: <23e4a2bd-41d4-5e14-9539-2acf326dd534@samsung.com>
On Tue, Nov 08, 2016 at 07:36:45AM +0100, Marek Szyprowski wrote:
> Hi Luis,
>
>
> On 2016-11-07 22:15, Luis R. Rodriguez wrote:
> > On Wed, Nov 02, 2016 at 08:58:38AM +0100, Marek Szyprowski wrote:
> > > On 2016-10-31 18:47, Greg Kroah-Hartman wrote:
> > > > On Sun, Oct 30, 2016 at 05:22:13PM +0100, Rafael J. Wysocki wrote:
> > > > > Let me quote from the previous intro messages for this series first:
> > > > >
> > > > > > > Time for another update. :-)
> > > > > > >
> > > > > > > Fewer changes this time, mostly to address issues found by Lukas and
> > > > > > > Marek.
> > > > > > >
> > > > > > > The most significant one is to make device_link_add() cope with the case
> > > > > > > when
> > > > > > > the consumer device has not been registered yet when it is called. The
> > > > > > > supplier device still is required to be registered and the function will
> > > > > > > return NULL if that is not the case.
> > > > > > >
> > > > > > > Another significant change is in patch [4/5] that now makes the core apply
> > > > > > > pm_runtime_get_sync()/pm_runtime_put() to supplier devices around the
> > > > > > > probing of a consumer one (in analogy with the parent).
> > > > > > One more update after some conversations during LinuxCon Europe.
> > > > > >
> > > > > > The main point was to make it possible for device_link_add() to figure out
> > > > > > the initial state of the link instead of expecting the caller to provide it
> > > > > > which might not be reliable enough in general.
> > > > > >
> > > > > > In this version device_link_add() takes three arguments, the supplier and
> > > > > > consumer pointers and flags and it sets the correct initial state of the
> > > > > > link automatically (unless invoked with the "stateless" flag, of course).
> > > > > > The cost is one additional field in struct device (I moved all of the
> > > > > > links-related fields in struct device to a separate sub-structure while at
> > > > > > it) to track the "driver presence status" of the device (to be used by
> > > > > > device_link_add()).
> > > > > >
> > > > > > In addition to that, the links list walks in the core.c and dd.c code are
> > > > > > under the device links mutex now, so the iternal link spinlock is not needed
> > > > > > any more and I have renamed symbols to distinguish between flags, link
> > > > > > states and device "driver presence statuses".
> > > > > The most significant change in this revision with respect to the previous one is
> > > > > related to the fact that SRCU is not available on some architectures, so the
> > > > > code falls back to using an RW semaphore for synchronization if SRCU is not
> > > > > there. Fortunately, the code changes needed for that turned out to be quite
> > > > > straightforward and confined to the second patch.
> > > > >
> > > > > Apart from this, the flags are defined using BIT(x) now (instead of open coding
> > > > > the latter in the flag definitions).
> > > > >
> > > > > Updated is mostly patch [2/5]. Patches [1,3,5/5] have not changed (except for
> > > > > trivial rebasing) and patch [4/5] needed to be refreshed on top of the modified
> > > > > [2/5].
> > > > >
> > > > > FWIW, I've run the series through 0-day which has not reported any problems
> > > > > with it.
> > > > Great, they are now applied to my tree, thanks again for doing this
> > > > work.
> > > Thanks for merging those patches! Could you provide a stable tag with them,
> > > so I can
> > > ask Joerg to merge my Exynos IOMMU PM patches on top of it via IOMMU tree?
> > You want these patches to be merged into stable?! This is a whole new set of
> > functionality, the patches in no way describe any *fixes* or critical issues,
> > why are you saying this is needed? What makes you believe this is a stable
> > candidate?
>
> I don't want to merge those patches to stale kernel release. By 'stable tag'
> I just meant something that can be pulled by Joerg to have a base for my
> Exynos IOMMU patches.
Phew! Thanks for the clarification!
Luis
^ permalink raw reply
* Re: possible bug in nfs-kernel-server
From: J. Bruce Fields @ 2016-11-08 20:16 UTC (permalink / raw)
To: Omar Walid Llorente
Cc: Soumya Koduri, Jeff Layton, linux-nfs,
administración del centro de cálculo del dit
In-Reply-To: <2443f0d3-6937-ae92-d4d5-6e1f00a19e81@dit.upm.es>
On Wed, Oct 19, 2016 at 07:53:37PM +0200, Omar Walid Llorente wrote:
> Resending because it has not been accepted by
> linux-nfs@vger.kernel.org because of the HTML... Sorry if you get it
> twice.
>
> Thanks again.
>
> Omar
>
> --- Forwarded message ---
>
> Hi Bruce, others.
Sory for the delayed response. This is a fairly complicated setup that
may require people with nfs, gluster, and zfs experience to debug.
The server does need to be able to bypass certain permission checks on
open so that it can open a newly created read-only file for write.
Probably one of those lower layers is insisting on permission checks
where it shouldn't. That's all I can say from a quick look.
--b.
>
> I come back to this issue again in the hope that these evidences I
> bring can help to give some light to the problem.
>
> We have exactly the same environment that last year when I came to
> you, but with upgraded versions of gluster (3.8) and
> nfs-kernel-server (1.2.8) this time over an updated Ubuntu 16.04.
>
> (NOTE: Environment: glusterfs-cluster made of ZFS datasets exports
> via glusterfs a distributed volume + nfs-kernel server mounts via
> fuse that glusterfs volume and reexports it via nfs-v3 + nfs-common
> client mounts via nfs that nfs exported volume)
>
> The errors I get by the user side are exactly the same, but in the
> server side, I have different messages, which I forward to you.
>
> * /TESTS/ and errors by the user side:
>
> u056@l056:~$ rm -f kk.txt 444.txt; echo "prueba" > 444.txt; chmod
> 444 444.txt; cp -p 444.txt kk.txt; ls -ld 444.txt kk.txt
> cp: cannot create regular file ‘kk.txt’: Permission denied
> ls: cannot access kk.txt: No such file or directory
> -r--r--r-- 1 u056 admincdc 7 oct 19 2016 444.txt
> u056@l056:~$ ls -lrt
> total 33
> ---------- 1 u056 admincdc 0 ene 4 1970 kk.txt
> drwx------ 2 u056 alumno 4096 oct 3 2014 Desktop
> drwxr-xr-x 2 u056 alumno 4096 sep 23 12:20 Público
> drwxr-xr-x 2 u056 alumno 4096 sep 23 12:20 Descargas
> drwxr-xr-x 2 u056 alumno 4096 sep 23 12:20 Documentos
> drwxr-xr-x 2 u056 alumno 4096 sep 23 12:20 Vídeos
> drwxr-xr-x 2 u056 alumno 4096 sep 23 12:20 Música
> drwxr-xr-x 2 u056 alumno 4096 sep 23 12:20 Plantillas
> drwxr-xr-x 2 u056 alumno 4096 sep 23 12:22 Imágenes
> -r--r--r-- 1 u056 admincdc 7 oct 19 17:34 444.txt
>
> u056@l056:~$ mount | grep cuentas09
> cuentas09:/home-3/u056 on /home/u056 type nfs (rw,noatime,intr,fsc,nolock,rsize=262140,wsize=262140,vers=4,addr=138.4.30.80,clientaddr=138.4.31.56)
> u056@l056:~$ df -h | grep cuentas09
> cuentas09:/home-3/u056 40T 55G 40T 1% /home/u056
> u056@l056:~$
>
> * /LOGS/ by the glusterfs client side (server side), versions of the
> software, info of the kernel and related kernel modules:
>
> root@cuentas09-lab:/var/log/glusterfs# tail home-3.log
> [2016-10-19 15:33:38.091300] I [io-stats.c:1574:io_stats_dump_fd]
> 0-home-lab-3: --- fd stats ---
> [2016-10-19 15:33:38.091331] I [io-stats.c:1579:io_stats_dump_fd]
> 0-home-lab-3: Filename : /u056/444.txt
> [2016-10-19 15:33:38.091344] I [io-stats.c:1594:io_stats_dump_fd]
> 0-home-lab-3: BytesWritten : 7 bytes
> [2016-10-19 15:33:38.091355] I [io-stats.c:1606:io_stats_dump_fd]
> 0-home-lab-3: Write 000004b+ : 1
> [2016-10-19 15:34:13.199285] I [io-stats.c:1574:io_stats_dump_fd]
> 0-home-lab-3: --- fd stats ---
> [2016-10-19 15:34:13.200291] I [io-stats.c:1579:io_stats_dump_fd]
> 0-home-lab-3: Filename : /u056/444.txt
> [2016-10-19 15:34:13.200313] I [io-stats.c:1594:io_stats_dump_fd]
> 0-home-lab-3: BytesWritten : 7 bytes
> [2016-10-19 15:34:13.200325] I [io-stats.c:1606:io_stats_dump_fd]
> 0-home-lab-3: Write 000004b+ : 1
> [2016-10-19 15:34:13.211696] E [MSGID: 114031]
> [client-rpc-fops.c:444:client3_3_open_cbk] 0-home-lab-3-client-0:
> remote operation failed. Path: /u056/kk.txt
> (d8fc54a3-f2eb-4538-889a-17afdcfbb255) [Permission denied]
> [2016-10-19 15:34:13.211758] W [fuse-bridge.c:989:fuse_fd_cbk]
> 0-glusterfs-fuse: 630: OPEN() /u056/kk.txt => -1 (Permission denied)
>
> root@cuentas09-lab:/var/log/glusterfs# dpkg -l | grep -e gluster -e nfs
> ii glusterfs-client 3.8.5-ubuntu1~xenial1 amd64
> clustered file-system (client package)
> ii glusterfs-common 3.8.5-ubuntu1~xenial1 amd64
> GlusterFS common libraries and translator modules
> ii libnfsidmap2:amd64 0.25-5 amd64
> NFS idmapping library
> ii nfs-common 1:1.2.8-9ubuntu12 amd64 NFS
> support files common to client and server
> ii nfs-kernel-server 1:1.2.8-9ubuntu12 amd64
> support for NFS kernel server
>
> root@cuentas09-lab:/var/log/glusterfs# uname -a
> Linux cuentas09-lab.lab.dit.upm.es 4.4.0-43-generic #63-Ubuntu SMP
> Wed Oct 12 13:48:03 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
>
> root@cuentas09-lab:/var/log/glusterfs# lsmod | grep nfs
> nfsd 319488 13
> auth_rpcgss 61440 1 nfsd
> nfs_acl 16384 1 nfsd
> lockd 94208 1 nfsd
> grace 16384 2 nfsd,lockd
> sunrpc 335872 21 nfsd,auth_rpcgss,lockd,nfs_acl
> root@cuentas09-lab:/var/log/glusterfs#
>
> * /LOGS/ by the nfs-kernel server side and basic configuration of
> the nfs-kernel-server:
>
> root@cuentas09-lab:~# less /var/log/kern.log
> root@cuentas09-lab:~# tail -30 !$
> tail -30 /var/log/kern.log
> Oct 19 17:30:24 cuentas09-lab kernel: [ 1573.631498]
> [<ffffffff810a0850>] ? kthread_create_on_node+0x1e0/0x1e0
> Oct 19 17:30:24 cuentas09-lab kernel: [ 1573.631504]
> [<ffffffff81831c4f>] ret_from_fork+0x3f/0x70
> Oct 19 17:30:24 cuentas09-lab kernel: [ 1573.631507]
> [<ffffffff810a0850>] ? kthread_create_on_node+0x1e0/0x1e0
> Oct 19 17:30:24 cuentas09-lab kernel: [ 1573.631510] ---[ end trace
> 34db7650fa22d1d0 ]---
> Oct 19 17:34:13 cuentas09-lab kernel: [ 1802.814898] ------------[
> cut here ]------------
> Oct 19 17:34:13 cuentas09-lab kernel: [ 1802.814948] WARNING: CPU: 0
> PID: 1373 at /build/linux-BwgxJb/linux-4.4.0/fs/nfsd/nfs4proc.c:464
> nfsd4_open+0x515/0x780 [nfsd]()
> Oct 19 17:34:13 cuentas09-lab kernel: [ 1802.814951]
> nfsd4_process_open2 failed to open newly-created file! status=13
> Oct 19 17:34:13 cuentas09-lab kernel: [ 1802.814954] Modules linked
> in: vmw_vsock_vmci_transport vsock ppdev vmw_balloon coretemp joydev
> input_leds serio_raw irda 8250_fintek parport_pc shpchp parport
> i2c_piix4 crc_ccitt vmw_vmci mac_hid ib_iser nfsd rdma_cm iw_cm
> ib_cm auth_rpcgss nfs_acl lockd grace ib_sa sunrpc ib_mad ib_core
> ib_addr iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi autofs4
> btrfs raid10 raid456 async_raid6_recov async_memcpy async_pq
> async_xor async_tx xor raid6_pq libcrc32c raid1 raid0 multipath
> linear vmwgfx ttm psmouse drm_kms_helper syscopyarea sysfillrect
> sysimgblt fb_sys_fops mptspi mptscsih mptbase drm e1000
> scsi_transport_spi pata_acpi floppy fjes
> Oct 19 17:34:13 cuentas09-lab kernel: [ 1802.815018] CPU: 0 PID:
> 1373 Comm: nfsd Tainted: G W 4.4.0-43-generic
> #63-Ubuntu
> Oct 19 17:34:13 cuentas09-lab kernel: [ 1802.815021] Hardware name:
> VMware, Inc. VMware Virtual Platform/440BX Desktop Reference
> Platform, BIOS 6.00 09/22/2009
> Oct 19 17:34:13 cuentas09-lab kernel: [ 1802.815024]
> 0000000000000286 00000000c0e912c3 ffff8800b93c7c80 ffffffff813f1f93
> Oct 19 17:34:13 cuentas09-lab kernel: [ 1802.815028]
> ffff8800b93c7cc8 ffffffffc047b668 ffff8800b93c7cb8 ffffffff81081212
> Oct 19 17:34:13 cuentas09-lab kernel: [ 1802.815031]
> ffff8800b9e43240 ffff8800b9e44068 000000000d000000 ffff8800b85e6000
> Oct 19 17:34:13 cuentas09-lab kernel: [ 1802.815035] Call Trace:
> Oct 19 17:34:13 cuentas09-lab kernel: [ 1802.815047]
> [<ffffffff813f1f93>] dump_stack+0x63/0x90
> Oct 19 17:34:13 cuentas09-lab kernel: [ 1802.815055]
> [<ffffffff81081212>] warn_slowpath_common+0x82/0xc0
> Oct 19 17:34:13 cuentas09-lab kernel: [ 1802.815058]
> [<ffffffff810812ac>] warn_slowpath_fmt+0x5c/0x80
> Oct 19 17:34:13 cuentas09-lab kernel: [ 1802.815073]
> [<ffffffffc04665db>] ? nfs4_free_ol_stateid+0x3b/0x40 [nfsd]
> Oct 19 17:34:13 cuentas09-lab kernel: [ 1802.815085]
> [<ffffffffc0459d05>] nfsd4_open+0x515/0x780 [nfsd]
> Oct 19 17:34:13 cuentas09-lab kernel: [ 1802.815098]
> [<ffffffffc045a2fa>] nfsd4_proc_compound+0x38a/0x660 [nfsd]
> Oct 19 17:34:13 cuentas09-lab kernel: [ 1802.815108]
> [<ffffffffc0446e78>] nfsd_dispatch+0xb8/0x200 [nfsd]
> Oct 19 17:34:13 cuentas09-lab kernel: [ 1802.815132]
> [<ffffffffc039eeac>] svc_process_common+0x40c/0x650 [sunrpc]
> Oct 19 17:34:13 cuentas09-lab kernel: [ 1802.815151]
> [<ffffffffc03a0273>] svc_process+0x103/0x1c0 [sunrpc]
> Oct 19 17:34:13 cuentas09-lab kernel: [ 1802.815160]
> [<ffffffffc04468cf>] nfsd+0xef/0x160 [nfsd]
> Oct 19 17:34:13 cuentas09-lab kernel: [ 1802.815170]
> [<ffffffffc04467e0>] ? nfsd_destroy+0x60/0x60 [nfsd]
> Oct 19 17:34:13 cuentas09-lab kernel: [ 1802.815174]
> [<ffffffff810a0928>] kthread+0xd8/0xf0
> Oct 19 17:34:13 cuentas09-lab kernel: [ 1802.815178]
> [<ffffffff810a0850>] ? kthread_create_on_node+0x1e0/0x1e0
> Oct 19 17:34:13 cuentas09-lab kernel: [ 1802.815184]
> [<ffffffff81831c4f>] ret_from_fork+0x3f/0x70
> Oct 19 17:34:13 cuentas09-lab kernel: [ 1802.815187]
> [<ffffffff810a0850>] ? kthread_create_on_node+0x1e0/0x1e0
> Oct 19 17:34:13 cuentas09-lab kernel: [ 1802.815190] ---[ end trace
> 34db7650fa22d1d1 ]---
> root@cuentas09-lab:~#
>
> root@cuentas09-lab:~# showmount -e
> Export list for cuentas09-lab.lab.dit.upm.es:
> /home-4 138.4.30.0/23
> /home-3 138.4.30.0/23
>
> root@cuentas09-lab:~# cat /etc/exports | grep -v ^#
> /home-3 138.4.30.0/23(rw,fsid=3,insecure,no_subtree_check,async,no_root_squash)
> /home-4 138.4.30.0/23(rw,fsid=4,insecure,no_subtree_check,async,no_root_squash)
> root@cuentas09-lab:~#
>
> root@cuentas09-lab:~# cat /etc/default/nfs-kernel-server | grep -v ^#
> RPCNFSDCOUNT="8 -V 3"
> RPCNFSDPRIORITY=0
> RPCMOUNTDOPTS="--manage-gids"
> NEED_SVCGSSD=""
> RPCSVCGSSDOPTS=""
> RPCNFSDOPTS="-d -V 3"
> root@cuentas09-lab:~#
>
> * LOGS by the glusterfs server side:
>
> # for i in 10 11 12 13; do echo recipiente$i; ssh recipiente$i tail
> /var/log/glusterfs/bricks/data-recipiente$i-gluster-home-lab-3.log;
> done
> recipiente10
> [2016-10-19 15:27:48.172858] I [io-stats.c:1606:io_stats_dump_fd]
> 0-/data/recipiente10-gluster-home-lab-3: Write 000008b+ : 1
> [2016-10-19 15:29:32.626450] I [io-stats.c:1574:io_stats_dump_fd]
> 0-/data/recipiente10-gluster-home-lab-3: --- fd stats ---
> [2016-10-19 15:29:32.626545] I [io-stats.c:1579:io_stats_dump_fd]
> 0-/data/recipiente10-gluster-home-lab-3: Filename :
> /u056/.local/share/tracker/data/tracker-store.journal
> [2016-10-19 15:29:32.626572] I [io-stats.c:1594:io_stats_dump_fd]
> 0-/data/recipiente10-gluster-home-lab-3: BytesWritten : 8 bytes
> [2016-10-19 15:29:32.626594] I [io-stats.c:1606:io_stats_dump_fd]
> 0-/data/recipiente10-gluster-home-lab-3: Write 000008b+ : 1
> [2016-10-19 15:30:23.997592] E [MSGID: 115070]
> [server-rpc-fops.c:1472:server_open_cbk] 0-home-lab-3-server: 372:
> OPEN /u056/kk.txt (cc97d150-c725-42b6-9aa5-50328f281e06) ==>
> (Permission denied) [Permission denied]
> [2016-10-19 15:32:28.423380] I [io-stats.c:1574:io_stats_dump_fd]
> 0-/data/recipiente10-gluster-home-lab-3: --- fd stats ---
> [2016-10-19 15:32:28.423478] I [io-stats.c:1579:io_stats_dump_fd]
> 0-/data/recipiente10-gluster-home-lab-3: Filename :
> /u056/.bashrc
> [2016-10-19 15:32:28.423504] I [io-stats.c:1584:io_stats_dump_fd]
> 0-/data/recipiente10-gluster-home-lab-3: Lifetime : 280secs,
> 232488usecs
> [2016-10-19 15:34:13.176805] E [MSGID: 115070]
> [server-rpc-fops.c:1472:server_open_cbk] 0-home-lab-3-server: 424:
> OPEN /u056/kk.txt (d8fc54a3-f2eb-4538-889a-17afdcfbb255) ==>
> (Permission denied) [Permission denied]
> recipiente11
> [2016-10-19 15:33:38.057524] I [io-stats.c:1579:io_stats_dump_fd]
> 0-/data/recipiente11-gluster-home-lab-3: Filename :
> /u056/444.txt
> [2016-10-19 15:33:38.057548] I [io-stats.c:1594:io_stats_dump_fd]
> 0-/data/recipiente11-gluster-home-lab-3: BytesWritten : 7 bytes
> [2016-10-19 15:33:38.057570] I [io-stats.c:1606:io_stats_dump_fd]
> 0-/data/recipiente11-gluster-home-lab-3: Write 000004b+ : 1
> [2016-10-19 15:34:13.164629] I [io-stats.c:1574:io_stats_dump_fd]
> 0-/data/recipiente11-gluster-home-lab-3: --- fd stats ---
> [2016-10-19 15:34:13.164722] I [io-stats.c:1579:io_stats_dump_fd]
> 0-/data/recipiente11-gluster-home-lab-3: Filename :
> /u056/444.txt
> [2016-10-19 15:34:13.164769] I [io-stats.c:1594:io_stats_dump_fd]
> 0-/data/recipiente11-gluster-home-lab-3: BytesWritten : 7 bytes
> [2016-10-19 15:34:13.164791] I [io-stats.c:1606:io_stats_dump_fd]
> 0-/data/recipiente11-gluster-home-lab-3: Write 000004b+ : 1
> [2016-10-19 15:36:29.066078] I [io-stats.c:1574:io_stats_dump_fd]
> 0-/data/recipiente11-gluster-home-lab-3: --- fd stats ---
> [2016-10-19 15:36:29.066180] I [io-stats.c:1579:io_stats_dump_fd]
> 0-/data/recipiente11-gluster-home-lab-3: Filename :
> /u056/444.txt
> [2016-10-19 15:36:29.066206] I [io-stats.c:1584:io_stats_dump_fd]
> 0-/data/recipiente11-gluster-home-lab-3: Lifetime : 136secs,
> 894418usecs
> recipiente12
> [2016-10-19 15:29:06.022950] I [io-stats.c:1594:io_stats_dump_fd]
> 0-/data/recipiente12-gluster-home-lab-3: BytesWritten : 986 bytes
> [2016-10-19 15:29:06.022972] I [io-stats.c:1606:io_stats_dump_fd]
> 0-/data/recipiente12-gluster-home-lab-3: Write 000512b+ : 1
> [2016-10-19 15:29:32.646111] I [io-stats.c:1574:io_stats_dump_fd]
> 0-/data/recipiente12-gluster-home-lab-3: --- fd stats ---
> [2016-10-19 15:29:32.646214] I [io-stats.c:1579:io_stats_dump_fd]
> 0-/data/recipiente12-gluster-home-lab-3: Filename :
> /u056/.profile
> [2016-10-19 15:32:28.423115] I [io-stats.c:1574:io_stats_dump_fd]
> 0-/data/recipiente12-gluster-home-lab-3: --- fd stats ---
> [2016-10-19 15:32:28.423219] I [io-stats.c:1579:io_stats_dump_fd]
> 0-/data/recipiente12-gluster-home-lab-3: Filename :
> /u056/.bash_logout
> [2016-10-19 15:32:28.423247] I [io-stats.c:1584:io_stats_dump_fd]
> 0-/data/recipiente12-gluster-home-lab-3: Lifetime : 202secs,
> 412682usecs
> [2016-10-19 15:32:28.423345] I [io-stats.c:1574:io_stats_dump_fd]
> 0-/data/recipiente12-gluster-home-lab-3: --- fd stats ---
> [2016-10-19 15:32:28.423378] I [io-stats.c:1579:io_stats_dump_fd]
> 0-/data/recipiente12-gluster-home-lab-3: Filename :
> /u056/.bash_history
> [2016-10-19 15:32:28.423400] I [io-stats.c:1584:io_stats_dump_fd]
> 0-/data/recipiente12-gluster-home-lab-3: Lifetime : 202secs,
> 399903usecs
> recipiente13
> [2016-10-19 15:04:26.825754] I [io-stats.c:1574:io_stats_dump_fd]
> 0-/data/recipiente13-gluster-home-lab-3: --- fd stats ---
> [2016-10-19 15:04:26.825788] I [io-stats.c:1579:io_stats_dump_fd]
> 0-/data/recipiente13-gluster-home-lab-3: Filename : /u056/pp
> [2016-10-19 15:04:26.825799] I [MSGID: 101055]
> [client_t.c:415:gf_client_unref] 0-home-lab-3-server: Shutting down
> connection cuentas09-lab.lab.dit.upm.es-1578-2016/10/19-05:00:48:464910-home-lab-3-client-3-0-0
> [2016-10-19 15:04:26.825813] I [io-stats.c:1584:io_stats_dump_fd]
> 0-/data/recipiente13-gluster-home-lab-3: Lifetime : 25804secs,
> 917102usecs
> [2016-10-19 15:04:26.825991] I [io-stats.c:1574:io_stats_dump_fd]
> 0-/data/recipiente13-gluster-home-lab-3: --- fd stats ---
> [2016-10-19 15:04:26.826026] I [io-stats.c:1579:io_stats_dump_fd]
> 0-/data/recipiente13-gluster-home-lab-3: Filename :
> /u056/.local/share/evolution/tasks/system/tasks.ics
> [2016-10-19 15:04:26.826050] I [io-stats.c:1584:io_stats_dump_fd]
> 0-/data/recipiente13-gluster-home-lab-3: Lifetime : 25774secs,
> 172800usecs
> [2016-10-19 15:04:48.333183] I [MSGID: 115029]
> [server-handshake.c:692:server_setvolume] 0-home-lab-3-server:
> accepted client from cuentas09-lab.lab.dit.upm.es-1610-2016/10/19-15:04:46:807972-home-lab-3-client-3-0-0
> (version: 3.8.5)
> [2016-10-19 15:27:27.763705] E [MSGID: 115070]
> [server-rpc-fops.c:1472:server_open_cbk] 0-home-lab-3-server: 149:
> OPEN /u056/.Xauthority-c (a4fa9bc4-a09e-4eb8-968b-b77cb6d49fd3) ==>
> (Permission denied) [Permission denied]
> [2016-10-19 15:29:12.202792] E [MSGID: 115070]
> [server-rpc-fops.c:1472:server_open_cbk] 0-home-lab-3-server: 267:
> OPEN /u056/.Xauthority-c (ce222a86-9f74-42d1-8e18-1f80f607d766) ==>
> (Permission denied) [Permission denied]
> root@admin2:~#
>
> As you can see, the glusterfs client part of the server
> fuse-mounting the volume shows a "/u056/kk.txt => -1 (Permission
> denied)" error that comes from a similar error in the glusterfs
> cluster, while at the nfs-kernel server log we can see a kernel
> trace directly related to the glusterfs fuse mount of the volume
> that says "nfsd4_process_open2 failed to open newly-created file!
> status=13".
>
> This error can be reproduced any number of times exactly the same,
> is not sporadic.
>
> Other test I've done at the client side with no logs at all at the
> server side, but the same error for the user, is the following:
>
> u056@l056:~$ rm -f 444.txt; echo "prueba" > 444.txt; chmod 444
> 444.txt; echo "kk" > 444.txt
> -bash: 444.txt: Permission denied
> u056@l056:~$
>
> We have been trying to reproduce this problem in a virtual
> environment using KVM, nfs-kernel-server, glusterfs, and ZFS over
> VFS, being unable to do it... This leads us to think that creating
> glusterfs volumes over ZFS over phisical disks has something to do
> with this problem, but we have no clue on how to track it down to
> the ZFS level, as there are no traces on the kernel.log or the
> syslog that we can use.
>
> Thank you for your time.
>
> Omar
>
> El 21/12/15 a las 21:14, J. Bruce Fields escribió:
> >On Mon, Dec 21, 2015 at 11:28:36PM +0530, Soumya Koduri wrote:
> >>
> >>On 12/21/2015 10:17 PM, J. Bruce Fields wrote:
> >>>On Mon, Dec 21, 2015 at 02:18:20PM +0530, Soumya Koduri wrote:
> >>>>
> >>>>On 12/19/2015 01:38 AM, J. Bruce Fields wrote:
> >>>>>On Fri, Dec 18, 2015 at 10:47:42PM +0530, Soumya Koduri wrote:
> >>>>>>
> >>>>>>On 12/18/2015 08:50 PM, J. Bruce Fields wrote:
> >>>>>>>On Fri, Dec 18, 2015 at 02:13:40PM +0530, Soumya Koduri wrote:
> >>>>>>>>
> >>>>>>>>On 12/18/2015 06:07 AM, Malahal Naineni wrote:
> >>>>>>>>>IIRC, permission checks are done in open(). write/read syscalls should
> >>>>>>>>>NOT do much access checks (at least based on POSIX). This is why once an
> >>>>>>>>>open is done, you remove permissions for that process, but it should
> >>>>>>>>>still be able to read/write based on the open flags it did when it
> >>>>>>>>>opened the file.
> >>>>>>>>>
> >>>>>>>>>I don't know all the details of this defect, but gluster seems to be
> >>>>>>>>>doing what it is supposed to do.
> >>>>>>>>>
> >>>>>>>>Right. Thanks for the correction. I assumed the behavior should be
> >>>>>>>>same for both OPEN+WRITE vs CREATE+WRITE in the below scenario. But
> >>>>>>>>looks like (from 'man creat') the open() call that creates a
> >>>>>>>>read-only file may well return a read/write file descriptor, which
> >>>>>>>>is the reason the following WRITE can succeed.
> >>>>>>>I forgot another complication, which is that knsfd actually does a
> >>>>>>>temporary open before each read or write--I assume that's getting
> >>>>>>>translated into fuse and gluster open operations?
> >>>>>>>
> >>>>>>yes. It is the OPEN done as part of NFS WRITE which fails with
> >>>>>>EACCESS error (with both NFSv3 and NFSv4 mounts).
> >>>>>Makes sense for v3, but I wouldn't normally expect the extra temporary
> >>>>>open on v4 WRITEs. Could you share any details?
> >>>>>
> >>>>I re-tried the test on v4 mount using Fedora23 machine, acting as
> >>>>both NFS server and client (Linux#4.2.3-300.fc23.x86_64). Please
> >>>>find the pkt trace attached.
> >>>>
> >>>> 56 07:23:25.567134 ::1 -> ::1 NFS 288 V4 Call
> >>>>WRITE StateID: 0xf934 Offset: 0 Len: 7
> >>>> 57 07:23:25.567233 192.168.122.17 -> 192.168.122.202 GlusterFS 188
> >>>>V330 GETXATTR Call
> >>>> 58 07:23:25.567732 192.168.122.202 -> 192.168.122.17 GlusterFS 112
> >>>>V330 GETXATTR Reply (Call In 57)
> >>>> 59 07:23:25.567881 192.168.122.17 -> 192.168.122.202 GlusterFS 164
> >>>>V330 OPEN Call
> >>>Remind me what kernel version your server is on?
> >>NFS server is on fedora23 VM - Linux version 4.2.3-300.fc23.x86_64
> >We did reshuffle the code that does the temporary open on WRITE around
> >there--but it looks right to me, and I can't reproduce an open on WRITE
> >on that kernel myself.
> >
> >Maybe there's some further fuse or gluster debugging that would help
> >show where that open is coming from.
> >
> >--b.
> >
> >>Thanks,
> >>Soumya
> >>
> >>>--b.
> >>>
> >>>
> >>>> 60 07:23:25.568354 192.168.122.202 -> 192.168.122.17 GlusterFS 116
> >>>>V330 OPEN Reply (Call In 59)
> >>>> 61 07:23:25.568570 ::1 -> ::1 NFS 144 V4 Reply
> >>>>(Call In 56) WRITE Status: NFS4ERR_ACCESS
> >>>>
> >>>>Thanks,
> >>>>Soumya
> >>>>
> >>>>>--b.
> >>>>>
> >>>>>> 63 16:59:09.278651000 ::1 -> ::1 NFS 232 V3 WRITE
> >>>>>>Call, FH: 0x49a35e54 Offset: 0 Len: 7 FILE_SYNC
> >>>>>> 64 16:59:09.278926000 192.168.122.1 -> 192.168.122.202 GlusterFS
> >>>>>>164 V330 OPEN Call
> >>>>>> 65 16:59:09.278937000 192.168.122.1 -> 192.168.122.202 GlusterFS
> >>>>>>164 [RPC retransmission of #64][TCP Retransmission] V330 OPEN Call
> >>>>>> 66 16:59:09.279459000 192.168.122.202 -> 192.168.122.1 GlusterFS
> >>>>>>116 V330 OPEN Reply (Call In 64)
> >>>>>> 67 16:59:09.279459000 192.168.122.202 -> 192.168.122.1 GlusterFS
> >>>>>>116 [RPC duplicate of #66][TCP Retransmission] V330 OPEN Reply (Call
> >>>>>>In 64)
> >>>>>> 68 16:59:09.279733000 ::1 -> ::1 NFS 212 V3 WRITE
> >>>>>>Reply (Call In 63) Error: NFS3ERR_ACCES
> >>>>>>
> >>>>>>
> >>>>>>Thanks,
> >>>>>>Soumya
> >>>>>>
> >>>>>>>In which case it might be worth experimenting with NFSv4 or with Jeff
> >>>>>>>Layton's filehandle-caching patches. Neither's a real fix, but that
> >>>>>>>could help confirm whether it's the temporary opens that are a problem.
> >>>>>>>
> >>>>>>>--b.
> >>>>>>>
> >>>>>>>>Thanks,
> >>>>>>>>Soumya
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>>Regards, Malahal.
> >>>>>>>>>
> >>>>>>>>>Soumya Koduri [skoduri@redhat.com] wrote:
> >>>>>>>>>>As mentioned by Bruce, GlusterFS doesn't have owner-override rule
> >>>>>>>>>>except for setattr.
> >>>>>>>>>>
> >>>>>>>>>>I did few experiments to check why this test case passes on plain
> >>>>>>>>>>glusterfs fuse mount & NFS-Ganesha but fails with kernel-NFS.
> >>>>>>>>>>
> >>>>>>>>>>NFS-Ganesha (for most of the FSALs) seem to be passing the actual
> >>>>>>>>>>request credentials to the back-end filesystem only for
> >>>>>>>>>>CREATE(-like) and UNLINK fops. For all the remaining fops, it does
> >>>>>>>>>>the access check at its end and then perform the operation with root
> >>>>>>>>>>credentials. That's the reason WRITE succeeded in your case as
> >>>>>>>>>>NFS-Ganesha (like kernel-NFS) skipped the access check if the
> >>>>>>>>>>request caller_uid proved to be the file's owner.
> >>>>>>>>>>
> >>>>>>>>>>In case of native GlusterFS FUSE mount, there is no OPEN fop
> >>>>>>>>>>involved. WRITE is performed on the fd returned by CREATE. And
> >>>>>>>>>>strangely GlusterFS seem to be doing certain access checks only
> >>>>>>>>>>during OPEN but not for WRITE (this seems like a bug and probably
> >>>>>>>>>>needs to be fixed in Gluster).
> >>>>>>>>>>
> >>>>>>>>>>Thanks,
> >>>>>>>>>>Soumya
> >>>>>>>>>>
> >>>>>>>>>>On 12/14/2015 10:27 PM, Omar Walid Llorente wrote:
> >>>>>>>>>>>Thank you Bruce, others, for the responses. I send attached a complete
> >>>>>>>>>>>capture of the issue, including the glusterfs transactions.
> >>>>>>>>>>>
> >>>>>>>>>>>Hope this helps to clear where may it be...
> >>>>>>>>>>>
> >>>>>>>>>>>Omar
> >>>>>>>>>>>
> >>>>>>>>>>>El 10/12/15 a las 15:44, J. Bruce Fields escribió:
> >>>>>>>>>>>>On Thu, Dec 10, 2015 at 05:59:33PM +0530, Soumya Koduri wrote:
> >>>>>>>>>>>>>On 12/10/2015 04:02 PM, Omar Walid Llorente wrote:
> >>>>>>>>>>>>>>Hi, Jeff, Bruce, finally I got some time to get the capture of the nfs
> >>>>>>>>>>>>>>packets (you can find them in attached file nfs-problem-nks.pcap.zip).
> >>>>>>>>>>>>>>Sorry for being so late.
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>>What I did was the following:
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>>1st) Create the RO file:
> >>>>>>>>>>>>>>cdc@l056:~/prueba-git$ rm -f kk.txt 444.txt; echo "prueba" > 444.txt;
> >>>>>>>>>>>>>>chmod 444 444.txt;
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>>2nd) Init the capture:
> >>>>>>>>>>>>>>root@l056:~# tcpdump -i eth2 -w /tmp/nfs.pcap -s 512 port 2049
> >>>>>>>>>>>>>>tcpdump: listening on eth2, link-type EN10MB (Ethernet), capture size
> >>>>>>>>>>>>>>512 bytes
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>GlusterFS protocol is added to wireshark from version 1.8.0 [1]. It
> >>>>>>>>>>>>>may be helpful to see what GlusterFS operations are being processed
> >>>>>>>>>>>>>as part of NFS WRITE call (which has failed in this case).
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>Could you please try taking the packet trace on the machine where
> >>>>>>>>>>>>>NFS server is running (without filtering out based on the port
> >>>>>>>>>>>>>number).
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>Also I tried out the same test on Fedora22 machine, but haven't run
> >>>>>>>>>>>>>into any issue. What are the fuse mount options you have used to
> >>>>>>>>>>>>>mount gluster volume?
> >>>>>>>>>>>>Oh, I think this is a simple problem (but maybe hard to fix). The
> >>>>>>>>>>>>capture shows NFSv3 traffic like:
> >>>>>>>>>>>>
> >>>>>>>>>>>> CREATE -> OK
> >>>>>>>>>>>> SETATTR (mode set to 0400) -> OK
> >>>>>>>>>>>> WRITE -> NFS3ERR_ACCES
> >>>>>>>>>>>>
> >>>>>>>>>>>>That write would succeed locally (because the mode doesn't matter to a
> >>>>>>>>>>>>local application that already holds the file open). It would fail over
> >>>>>>>>>>>>NFSv3, which doesn't know about the open--except that there's a hack for
> >>>>>>>>>>>>this case: NFSv3 servers allow IO operations to ignore the mode, if the
> >>>>>>>>>>>>operation comes from the owner of the file. NFSv3 clients are then
> >>>>>>>>>>>>careful to perform necessary access checks on open to ensure that this
> >>>>>>>>>>>>owner-override rule doesn't grant too many permissions.
> >>>>>>>>>>>>
> >>>>>>>>>>>>That allows NFSv3 applications to see behavior that's mostly like a
> >>>>>>>>>>>>local filesystem, without opening much of a security hole (since the
> >>>>>>>>>>>>owner could always chmod anyway).
> >>>>>>>>>>>>
> >>>>>>>>>>>>So, knfsd is making this special exception--but gluster (which I believe
> >>>>>>>>>>>>it's exporting in this case, via fuse?)--probably doesn't.... I'm not
> >>>>>>>>>>>>sure what you can do about that.
> >>>>>>>>>>>>
> >>>>>>>>>>>>--b.
> >>>>>>>>>>--
> >>>>>>>>>>To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> >>>>>>>>>>the body of a message to majordomo@vger.kernel.org
> >>>>>>>>>>More majordomo info at http://vger.kernel.org/majordomo-info.html
> >>>>>>>>>>
> >>>>>--
> >>>>>To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> >>>>>the body of a message to majordomo@vger.kernel.org
> >>>>>More majordomo info at http://vger.kernel.org/majordomo-info.html
> >>>>>
> >>>
>
> --
> ----------------------------------------------------------------
> Centro de Cálculo Depto. Ingeniería Sistemas Telemáticos
> E-mail: omar@dit.upm.es Universidad Politécnica de Madrid
> Fax:(+34) 913367333 E.T.S. Ing. Telecomunicación
> Tel:(+34) 915495700-Ext.3005 28040 Madrid (Spain)
> Tel:(+34) 915495762-Ext.3005
> Tel:(+34) 913367366-Ext.3005
> ----------------------------------------------------------------
>
^ permalink raw reply
* [qemu-mainline test] 102031: regressions - FAIL
From: osstest service owner @ 2016-11-08 20:16 UTC (permalink / raw)
To: xen-devel, osstest-admin
flight 102031 qemu-mainline real [real]
http://logs.test-lab.xenproject.org/osstest/logs/102031/
Regressions :-(
Tests which did not succeed and are blocking,
including tests which could not be run:
test-amd64-amd64-libvirt 11 guest-start fail REGR. vs. 101909
test-amd64-i386-libvirt-xsm 11 guest-start fail REGR. vs. 101909
test-amd64-i386-libvirt 11 guest-start fail REGR. vs. 101909
test-amd64-i386-libvirt-pair 20 guest-start/debian fail REGR. vs. 101909
test-amd64-amd64-libvirt-xsm 11 guest-start fail REGR. vs. 101909
test-amd64-amd64-libvirt-vhd 9 debian-di-install fail REGR. vs. 101909
test-amd64-amd64-xl-qcow2 9 debian-di-install fail REGR. vs. 101909
test-amd64-i386-xl-qemuu-winxpsp3-vcpus1 9 windows-install fail REGR. vs. 101909
test-amd64-amd64-libvirt-pair 20 guest-start/debian fail REGR. vs. 101909
test-armhf-armhf-libvirt-xsm 11 guest-start fail REGR. vs. 101909
test-armhf-armhf-xl-vhd 9 debian-di-install fail REGR. vs. 101909
test-armhf-armhf-libvirt 11 guest-start fail REGR. vs. 101909
test-armhf-armhf-libvirt-raw 9 debian-di-install fail REGR. vs. 101909
test-armhf-armhf-libvirt-qcow2 9 debian-di-install fail REGR. vs. 101909
Regressions which are regarded as allowable (not blocking):
test-amd64-amd64-xl-qemuu-win7-amd64 16 guest-stop fail like 101909
test-amd64-i386-xl-qemuu-win7-amd64 16 guest-stop fail like 101909
test-amd64-amd64-xl-rtds 9 debian-install fail like 101909
Tests which did not succeed, but are not blocking:
test-amd64-amd64-xl-pvh-intel 11 guest-start fail never pass
test-amd64-amd64-xl-pvh-amd 11 guest-start fail never pass
test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 10 migrate-support-check fail never pass
test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 10 migrate-support-check fail never pass
test-armhf-armhf-xl-xsm 12 migrate-support-check fail never pass
test-armhf-armhf-xl-xsm 13 saverestore-support-check fail never pass
test-amd64-amd64-qemuu-nested-amd 16 debian-hvm-install/l1/l2 fail never pass
test-armhf-armhf-xl 12 migrate-support-check fail never pass
test-armhf-armhf-xl 13 saverestore-support-check fail never pass
test-armhf-armhf-xl-credit2 12 migrate-support-check fail never pass
test-armhf-armhf-xl-credit2 13 saverestore-support-check fail never pass
test-armhf-armhf-xl-arndale 12 migrate-support-check fail never pass
test-armhf-armhf-xl-arndale 13 saverestore-support-check fail never pass
test-armhf-armhf-xl-cubietruck 12 migrate-support-check fail never pass
test-armhf-armhf-xl-cubietruck 13 saverestore-support-check fail never pass
test-armhf-armhf-xl-multivcpu 12 migrate-support-check fail never pass
test-armhf-armhf-xl-multivcpu 13 saverestore-support-check fail never pass
test-armhf-armhf-xl-rtds 12 migrate-support-check fail never pass
test-armhf-armhf-xl-rtds 13 saverestore-support-check fail never pass
version targeted for testing:
qemuu 207faf24c58859f5240f66bf6decc33b87a1776e
baseline version:
qemuu 199a5bde46b0eab898ab1ec591f423000302569f
Last test of basis 101909 2016-11-03 23:21:40 Z 4 days
Failing since 101943 2016-11-04 22:40:48 Z 3 days 6 attempts
Testing same since 102031 2016-11-08 07:59:22 Z 0 days 1 attempts
------------------------------------------------------------
People who touched revisions under test:
Christian Borntraeger <borntraeger@de.ibm.com>
Cornelia Huck <cornelia.huck@de.ibm.com>
Julian Brown <julian@codesourcery.com>
Marcin Krzeminski <marcin.krzeminski@nokia.com>
Olaf Hering <olaf@aepfle.de>
Peter Maydell <peter.maydell@linaro.org>
Prasad J Pandit <pjp@fedoraproject.org>
Sander Eikelenboom <linux@eikelenboom.it>
Stefan Hajnoczi <stefanha@redhat.com>
Stefano Stabellini <sstabellini@kernel.org>
Thomas Huth <thuth@redhat.com>
Wei Liu <wei.liu2@citrix.com>
jobs:
build-amd64-xsm pass
build-armhf-xsm pass
build-i386-xsm pass
build-amd64 pass
build-armhf pass
build-i386 pass
build-amd64-libvirt pass
build-armhf-libvirt pass
build-i386-libvirt pass
build-amd64-pvops pass
build-armhf-pvops pass
build-i386-pvops pass
test-amd64-amd64-xl pass
test-armhf-armhf-xl pass
test-amd64-i386-xl pass
test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm pass
test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm pass
test-amd64-amd64-xl-qemuu-debianhvm-amd64-xsm pass
test-amd64-i386-xl-qemuu-debianhvm-amd64-xsm pass
test-amd64-amd64-libvirt-xsm fail
test-armhf-armhf-libvirt-xsm fail
test-amd64-i386-libvirt-xsm fail
test-amd64-amd64-xl-xsm pass
test-armhf-armhf-xl-xsm pass
test-amd64-i386-xl-xsm pass
test-amd64-amd64-qemuu-nested-amd fail
test-amd64-amd64-xl-pvh-amd fail
test-amd64-i386-qemuu-rhel6hvm-amd pass
test-amd64-amd64-xl-qemuu-debianhvm-amd64 pass
test-amd64-i386-xl-qemuu-debianhvm-amd64 pass
test-amd64-i386-freebsd10-amd64 pass
test-amd64-amd64-xl-qemuu-ovmf-amd64 pass
test-amd64-i386-xl-qemuu-ovmf-amd64 pass
test-amd64-amd64-xl-qemuu-win7-amd64 fail
test-amd64-i386-xl-qemuu-win7-amd64 fail
test-armhf-armhf-xl-arndale pass
test-amd64-amd64-xl-credit2 pass
test-armhf-armhf-xl-credit2 pass
test-armhf-armhf-xl-cubietruck pass
test-amd64-i386-freebsd10-i386 pass
test-amd64-amd64-qemuu-nested-intel pass
test-amd64-amd64-xl-pvh-intel fail
test-amd64-i386-qemuu-rhel6hvm-intel pass
test-amd64-amd64-libvirt fail
test-armhf-armhf-libvirt fail
test-amd64-i386-libvirt fail
test-amd64-amd64-xl-multivcpu pass
test-armhf-armhf-xl-multivcpu pass
test-amd64-amd64-pair pass
test-amd64-i386-pair pass
test-amd64-amd64-libvirt-pair fail
test-amd64-i386-libvirt-pair fail
test-amd64-amd64-amd64-pvgrub pass
test-amd64-amd64-i386-pvgrub pass
test-amd64-amd64-pygrub pass
test-armhf-armhf-libvirt-qcow2 fail
test-amd64-amd64-xl-qcow2 fail
test-armhf-armhf-libvirt-raw fail
test-amd64-i386-xl-raw pass
test-amd64-amd64-xl-rtds fail
test-armhf-armhf-xl-rtds pass
test-amd64-i386-xl-qemuu-winxpsp3-vcpus1 fail
test-amd64-amd64-libvirt-vhd fail
test-armhf-armhf-xl-vhd fail
test-amd64-amd64-xl-qemuu-winxpsp3 pass
test-amd64-i386-xl-qemuu-winxpsp3 pass
------------------------------------------------------------
sg-report-flight on osstest.test-lab.xenproject.org
logs: /home/logs/logs
images: /home/logs/images
Logs, config files, etc. are available at
http://logs.test-lab.xenproject.org/osstest/logs
Explanation of these reports, and of osstest in general, is at
http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README.email;hb=master
http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README;hb=master
Test harness code can be found at
http://xenbits.xen.org/gitweb?p=osstest.git;a=summary
Not pushing.
------------------------------------------------------------
commit 207faf24c58859f5240f66bf6decc33b87a1776e
Merge: 0ea3eb6 9706e01
Author: Stefan Hajnoczi <stefanha@redhat.com>
Date: Mon Nov 7 14:02:15 2016 +0000
Merge remote-tracking branch 'pm215/tags/pull-target-arm-20161107' into staging
target-arm queue:
* bitbang_i2c: Handle NACKs from devices
* Fix corruption of CPSR when SCTLR.EE is set
* nvic: set pending status for not active interrupts
* char: cadence: check baud rate generator and divider values
# gpg: Signature made Mon 07 Nov 2016 10:43:07 AM GMT
# gpg: using RSA key 0x3C2525ED14360CDE
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>"
# gpg: aka "Peter Maydell <pmaydell@gmail.com>"
# gpg: aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>"
# Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83 15CF 3C25 25ED 1436 0CDE
* pm215/tags/pull-target-arm-20161107:
hw/i2c/bitbang_i2c: Handle NACKs from devices
Fix corruption of CPSR when SCTLR.EE is set
nvic: set pending status for not active interrupts
char: cadence: check baud rate generator and divider values
Message-id: 1478515653-6361-1-git-send-email-peter.maydell@linaro.org
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
commit 0ea3eb65e84c5d4665dbeee3e3e5ed56b43f7648
Author: Cornelia Huck <cornelia.huck@de.ibm.com>
Date: Wed Nov 2 17:21:03 2016 +0100
s390x/kvm: fix run_on_cpu sigp conversions
Commit 14e6fe12a ("*_run_on_cpu: introduce run_on_cpu_data type")
attempted to convert all users of run_on_cpu to use the new
run_on_cpu_data type. It missed to change the called sigp_* routines,
however. Fix that.
Fixes: 14e6fe12a ("*_run_on_cpu: introduce run_on_cpu_data type")
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Message-id: 20161102162103.66480-1-cornelia.huck@de.ibm.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
commit 9706e0162d2405218fd7376ffdf13baed8569a4b
Author: Peter Maydell <peter.maydell@linaro.org>
Date: Mon Oct 24 19:12:29 2016 +0100
hw/i2c/bitbang_i2c: Handle NACKs from devices
If the guest attempts to talk to a nonexistent device over i2c,
the i2c_start_transfer() function will return non-zero, indicating
that the bus is signalling a NACK. Similarly, if the i2c_send()
function returns nonzero then the target device returned a NACK.
Handle this possibility in the bitbang_i2c code, by returning
the state machine to the STOPPED state and returning the NACK
bit to the guest.
This bit of missing functionality was spotted by Coverity
(it noticed that we weren't checking the return value from
i2c_start_transfer()).
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1477332749-27098-1-git-send-email-peter.maydell@linaro.org
commit 3823b9db77e753041c04c161ac9f4d4cfc661520
Author: Julian Brown <julian@codesourcery.com>
Date: Mon Nov 7 10:00:24 2016 +0000
Fix corruption of CPSR when SCTLR.EE is set
Fix a typo in arm_cpu_do_interrupt_aarch32 (OR'ing with ~CPSR_E
instead of CPSR_E) which meant that when we took an interrupt with
SCTLR.EE set we would corrupt the CPSR.
Signed-off-by: Julian Brown <julian@codesourcery.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
commit 3bc4b52ccd7754de4fb177871f1c5eaaa61ec7ef
Author: Marcin Krzeminski <marcin.krzeminski@nokia.com>
Date: Mon Nov 7 10:00:24 2016 +0000
nvic: set pending status for not active interrupts
According to ARM DUI 0552A 4.2.10. NVIC set pending status
also for disabled interrupts. Correct the logic for
when interrupts are marked pending both on input level
transition and when interrupts are dismissed, to match
the NVIC behaviour rather than the 11MPCore GIC.
Signed-off-by: Marcin Krzeminski <marcin.krzeminski@nokia.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
commit 6e29651c5e3a0e0336818574f273b3f6ecea491d
Author: Prasad J Pandit <pjp@fedoraproject.org>
Date: Mon Nov 7 10:00:24 2016 +0000
char: cadence: check baud rate generator and divider values
The Cadence UART device emulator calculates speed by dividing the
baud rate by a 'baud rate generator' & 'baud rate divider' value.
The device specification defines these register values to be
non-zero and within certain limits. Add checks for these limits
to avoid errors like divide by zero.
Reported-by: Huawei PSIRT <psirt@huawei.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
Message-id: 1477596278-1470-1-git-send-email-ppandit@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
commit 9226682a401f34b10fd79dfe17ba334da0800747
Merge: 199a5bd 021746c
Author: Stefan Hajnoczi <stefanha@redhat.com>
Date: Fri Nov 4 09:26:24 2016 +0000
Merge remote-tracking branch 'sstabellini/tags/xen-20161102-tag' into staging
Xen 2016/11/02
# gpg: Signature made Wed 02 Nov 2016 07:28:40 PM GMT
# gpg: using RSA key 0x894F8F4870E1AE90
# gpg: Good signature from "Stefano Stabellini <sstabellini@kernel.org>"
# gpg: aka "Stefano Stabellini <stefano.stabellini@eu.citrix.com>"
# Primary key fingerprint: D04E 33AB A51F 67BA 07D3 0AEA 894F 8F48 70E1 AE90
* sstabellini/tags/xen-20161102-tag:
PCMachineState: introduce acpi_build_enabled field
hw/xen/xen_pvdev: Include qemu/log.h for qemu_log_vprintf()
Message-id: alpine.DEB.2.10.1611021227530.19454@sstabellini-ThinkPad-X260
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
commit 021746c131cdfeab9d82ff918795a9f18d20d7ae
Author: Wei Liu <wei.liu2@citrix.com>
Date: Tue Nov 1 17:44:16 2016 +0000
PCMachineState: introduce acpi_build_enabled field
Introduce this field to control whether ACPI build is enabled by a
particular machine or accelerator.
It defaults to true if the machine itself supports ACPI build. Xen
accelerator will disable it because Xen is in charge of building ACPI
tables for the guest.
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Tested-by: Sander Eikelenboom <linux@eikelenboom.it>
commit b5863634181a655bd2201cf51a363ac94a43f145
Author: Thomas Huth <thuth@redhat.com>
Date: Wed Nov 2 11:19:18 2016 +0100
hw/xen/xen_pvdev: Include qemu/log.h for qemu_log_vprintf()
Olaf Hering reported a build failure due to an undefined reference
to 'qemu_log_vprintf'. Explicitely including qemu/log.h seems to
fix the issue.
Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
Tested-by: Olaf Hering <olaf@aepfle.de>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply
* Re: what is infernalis' EOL date?
From: Samuel Just @ 2016-11-08 20:17 UTC (permalink / raw)
To: Ken Dreyer; +Cc: ceph-devel
In-Reply-To: <CALqRxCz0GFp141xT92sNZVpPLkCoRnqwQSUkZfLJ=VLwEb50cA@mail.gmail.com>
I think the EOL would have been the date of the Jewel release, right?
-Sam
On Tue, Nov 8, 2016 at 8:50 AM, Ken Dreyer <kdreyer@redhat.com> wrote:
> Hi folks,
>
> http://docs.ceph.com/docs/master/releases/ does not list an EOL date
> for Infernalis.
>
> Can we say "Feb 2016" there? That was the date of the last point
> release, v9.2.1.
>
> - Ken
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [Intel-wired-lan] [PATCH v3] ixgbevf: handle race between close and suspend on shutdown
From: Emil Tantilov @ 2016-11-08 20:18 UTC (permalink / raw)
To: intel-wired-lan
When an interface is part of a namespace it is possible that
ixgbevf_close() may be called while ixgbevf_suspend() is running
which ends up in a double free WARN and/or a BUG in free_msi_irqs()
To handle this situation we extend the rtnl_lock() to protect the
call to netif_device_detach() and check for !netif_device_present()
to avoid entering close while in suspend.
Also added rtnl locks to ixgbevf_queue_reset_subtask().
-v2 handle the race with netif_device_detach/present() and rtnl
locks as suggested by Alex Duyck
-v3 add rtnl locks and check in ixgbevf_remove()
CC: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
---
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index d316f50..eac594c 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -3242,6 +3242,9 @@ int ixgbevf_close(struct net_device *netdev)
{
struct ixgbevf_adapter *adapter = netdev_priv(netdev);
+ if (!netif_device_present(netdev))
+ return 0;
+
ixgbevf_down(adapter);
ixgbevf_free_irq(adapter);
@@ -3268,6 +3271,8 @@ static void ixgbevf_queue_reset_subtask(struct ixgbevf_adapter *adapter)
* match packet buffer alignment. Unfortunately, the
* hardware is not flexible enough to do this dynamically.
*/
+ rtnl_lock();
+
if (netif_running(dev))
ixgbevf_close(dev);
@@ -3276,6 +3281,8 @@ static void ixgbevf_queue_reset_subtask(struct ixgbevf_adapter *adapter)
if (netif_running(dev))
ixgbevf_open(dev);
+
+ rtnl_unlock();
}
static void ixgbevf_tx_ctxtdesc(struct ixgbevf_ring *tx_ring,
@@ -3792,17 +3799,17 @@ static int ixgbevf_suspend(struct pci_dev *pdev, pm_message_t state)
int retval = 0;
#endif
+ rtnl_lock();
netif_device_detach(netdev);
if (netif_running(netdev)) {
- rtnl_lock();
ixgbevf_down(adapter);
ixgbevf_free_irq(adapter);
ixgbevf_free_all_tx_resources(adapter);
ixgbevf_free_all_rx_resources(adapter);
ixgbevf_clear_interrupt_scheme(adapter);
- rtnl_unlock();
}
+ rtnl_unlock();
#ifdef CONFIG_PM
retval = pci_save_state(pdev);
@@ -4199,8 +4206,12 @@ static void ixgbevf_remove(struct pci_dev *pdev)
if (netdev->reg_state == NETREG_REGISTERED)
unregister_netdev(netdev);
- ixgbevf_clear_interrupt_scheme(adapter);
- ixgbevf_reset_interrupt_capability(adapter);
+ rtnl_lock();
+ if (netif_device_present(netdev)) {
+ ixgbevf_clear_interrupt_scheme(adapter);
+ ixgbevf_reset_interrupt_capability(adapter);
+ }
+ rtnl_unlock();
iounmap(adapter->io_addr);
pci_release_regions(pdev);
^ permalink raw reply related
* [distros-debian-snapshot test] 68013: tolerable FAIL
From: Platform Team regression test user @ 2016-11-08 20:18 UTC (permalink / raw)
To: xen-devel, osstest-admin
flight 68013 distros-debian-snapshot real [real]
http://osstest.xs.citrite.net/~osstest/testlogs/logs/68013/
Failures :-/ but no regressions.
Regressions which are regarded as allowable (not blocking):
test-armhf-armhf-armhf-daily-netboot-pygrub 9 debian-di-install fail like 67973
test-amd64-amd64-i386-daily-netboot-pygrub 9 debian-di-install fail like 67973
test-amd64-amd64-amd64-daily-netboot-pvgrub 9 debian-di-install fail like 67973
test-amd64-i386-i386-daily-netboot-pvgrub 9 debian-di-install fail like 67973
test-amd64-i386-amd64-daily-netboot-pygrub 9 debian-di-install fail like 67973
test-amd64-i386-i386-weekly-netinst-pygrub 9 debian-di-install fail like 67973
test-amd64-amd64-i386-weekly-netinst-pygrub 9 debian-di-install fail like 67973
test-amd64-i386-amd64-weekly-netinst-pygrub 9 debian-di-install fail like 67973
test-amd64-amd64-amd64-weekly-netinst-pygrub 9 debian-di-install fail like 67973
baseline version:
flight 67973
jobs:
build-amd64 pass
build-armhf pass
build-i386 pass
build-amd64-pvops pass
build-armhf-pvops pass
build-i386-pvops pass
test-amd64-amd64-amd64-daily-netboot-pvgrub fail
test-amd64-i386-i386-daily-netboot-pvgrub fail
test-amd64-i386-amd64-daily-netboot-pygrub fail
test-armhf-armhf-armhf-daily-netboot-pygrub fail
test-amd64-amd64-i386-daily-netboot-pygrub fail
test-amd64-amd64-amd64-current-netinst-pygrub pass
test-amd64-i386-amd64-current-netinst-pygrub pass
test-amd64-amd64-i386-current-netinst-pygrub pass
test-amd64-i386-i386-current-netinst-pygrub pass
test-amd64-amd64-amd64-weekly-netinst-pygrub fail
test-amd64-i386-amd64-weekly-netinst-pygrub fail
test-amd64-amd64-i386-weekly-netinst-pygrub fail
test-amd64-i386-i386-weekly-netinst-pygrub fail
------------------------------------------------------------
sg-report-flight on osstest.xs.citrite.net
logs: /home/osstest/logs
images: /home/osstest/images
Logs, config files, etc. are available at
http://osstest.xs.citrite.net/~osstest/testlogs/logs
Test harness code can be found at
http://xenbits.xensource.com/gitweb?p=osstest.git;a=summary
Push not applicable.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply
* [ovmf test] 102036: all pass - PUSHED
From: osstest service owner @ 2016-11-08 20:18 UTC (permalink / raw)
To: xen-devel, osstest-admin
flight 102036 ovmf real [real]
http://logs.test-lab.xenproject.org/osstest/logs/102036/
Perfect :-)
All tests in this flight passed as required
version targeted for testing:
ovmf fef15ecd20dd8db5bf0c33b00908fc59491dba8a
baseline version:
ovmf d66f85cb5eed5c218d822204897a78bab53fc157
Last test of basis 102029 2016-11-08 04:46:30 Z 0 days
Testing same since 102036 2016-11-08 12:14:46 Z 0 days 1 attempts
------------------------------------------------------------
People who touched revisions under test:
Gary Lin <glin@suse.com>
Hao Wu <hao.a.wu@intel.com>
Maurice Ma <maurice.ma@intel.com>
jobs:
build-amd64-xsm pass
build-i386-xsm pass
build-amd64 pass
build-i386 pass
build-amd64-libvirt pass
build-i386-libvirt pass
build-amd64-pvops pass
build-i386-pvops pass
test-amd64-amd64-xl-qemuu-ovmf-amd64 pass
test-amd64-i386-xl-qemuu-ovmf-amd64 pass
------------------------------------------------------------
sg-report-flight on osstest.test-lab.xenproject.org
logs: /home/logs/logs
images: /home/logs/images
Logs, config files, etc. are available at
http://logs.test-lab.xenproject.org/osstest/logs
Explanation of these reports, and of osstest in general, is at
http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README.email;hb=master
http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README;hb=master
Test harness code can be found at
http://xenbits.xen.org/gitweb?p=osstest.git;a=summary
Pushing revision :
+ branch=ovmf
+ revision=fef15ecd20dd8db5bf0c33b00908fc59491dba8a
+ . ./cri-lock-repos
++ . ./cri-common
+++ . ./cri-getconfig
+++ umask 002
+++ getrepos
++++ getconfig Repos
++++ perl -e '
use Osstest;
readglobalconfig();
print $c{"Repos"} or die $!;
'
+++ local repos=/home/osstest/repos
+++ '[' -z /home/osstest/repos ']'
+++ '[' '!' -d /home/osstest/repos ']'
+++ echo /home/osstest/repos
++ repos=/home/osstest/repos
++ repos_lock=/home/osstest/repos/lock
++ '[' x '!=' x/home/osstest/repos/lock ']'
++ OSSTEST_REPOS_LOCK_LOCKED=/home/osstest/repos/lock
++ exec with-lock-ex -w /home/osstest/repos/lock ./ap-push ovmf fef15ecd20dd8db5bf0c33b00908fc59491dba8a
+ branch=ovmf
+ revision=fef15ecd20dd8db5bf0c33b00908fc59491dba8a
+ . ./cri-lock-repos
++ . ./cri-common
+++ . ./cri-getconfig
+++ umask 002
+++ getrepos
++++ getconfig Repos
++++ perl -e '
use Osstest;
readglobalconfig();
print $c{"Repos"} or die $!;
'
+++ local repos=/home/osstest/repos
+++ '[' -z /home/osstest/repos ']'
+++ '[' '!' -d /home/osstest/repos ']'
+++ echo /home/osstest/repos
++ repos=/home/osstest/repos
++ repos_lock=/home/osstest/repos/lock
++ '[' x/home/osstest/repos/lock '!=' x/home/osstest/repos/lock ']'
+ . ./cri-common
++ . ./cri-getconfig
++ umask 002
+ select_xenbranch
+ case "$branch" in
+ tree=ovmf
+ xenbranch=xen-unstable
+ '[' xovmf = xlinux ']'
+ linuxbranch=
+ '[' x = x ']'
+ qemuubranch=qemu-upstream-unstable
+ select_prevxenbranch
++ ./cri-getprevxenbranch xen-unstable
+ prevxenbranch=xen-4.7-testing
+ '[' xfef15ecd20dd8db5bf0c33b00908fc59491dba8a = x ']'
+ : tested/2.6.39.x
+ . ./ap-common
++ : osstest@xenbits.xen.org
+++ getconfig OsstestUpstream
+++ perl -e '
use Osstest;
readglobalconfig();
print $c{"OsstestUpstream"} or die $!;
'
++ :
++ : git://xenbits.xen.org/xen.git
++ : osstest@xenbits.xen.org:/home/xen/git/xen.git
++ : git://xenbits.xen.org/qemu-xen-traditional.git
++ : git://git.kernel.org
++ : git://git.kernel.org/pub/scm/linux/kernel/git
++ : git
++ : git://xenbits.xen.org/xtf.git
++ : osstest@xenbits.xen.org:/home/xen/git/xtf.git
++ : git://xenbits.xen.org/xtf.git
++ : git://xenbits.xen.org/libvirt.git
++ : osstest@xenbits.xen.org:/home/xen/git/libvirt.git
++ : git://xenbits.xen.org/libvirt.git
++ : git://xenbits.xen.org/osstest/rumprun.git
++ : git
++ : git://xenbits.xen.org/osstest/rumprun.git
++ : osstest@xenbits.xen.org:/home/xen/git/osstest/rumprun.git
++ : git://git.seabios.org/seabios.git
++ : osstest@xenbits.xen.org:/home/xen/git/osstest/seabios.git
++ : git://xenbits.xen.org/osstest/seabios.git
++ : https://github.com/tianocore/edk2.git
++ : osstest@xenbits.xen.org:/home/xen/git/osstest/ovmf.git
++ : git://xenbits.xen.org/osstest/ovmf.git
++ : git://xenbits.xen.org/osstest/linux-firmware.git
++ : osstest@xenbits.xen.org:/home/osstest/ext/linux-firmware.git
++ : git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
++ : osstest@xenbits.xen.org:/home/xen/git/linux-pvops.git
++ : git://xenbits.xen.org/linux-pvops.git
++ : tested/linux-3.14
++ : tested/linux-arm-xen
++ '[' xgit://xenbits.xen.org/linux-pvops.git = x ']'
++ '[' x = x ']'
++ : git://xenbits.xen.org/linux-pvops.git
++ : tested/linux-arm-xen
++ : git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen.git
++ : tested/2.6.39.x
++ : daily-cron.ovmf
++ : daily-cron.ovmf
++ : daily-cron.ovmf
++ : daily-cron.ovmf
++ : daily-cron.ovmf
++ : daily-cron.ovmf
++ : daily-cron.ovmf
++ : http://hg.uk.xensource.com/carbon/trunk/linux-2.6.27
++ : git://xenbits.xen.org/qemu-xen.git
++ : osstest@xenbits.xen.org:/home/xen/git/qemu-xen.git
++ : daily-cron.ovmf
++ : git://xenbits.xen.org/qemu-xen.git
++ : git://git.qemu.org/qemu.git
+ TREE_LINUX=osstest@xenbits.xen.org:/home/xen/git/linux-pvops.git
+ TREE_QEMU_UPSTREAM=osstest@xenbits.xen.org:/home/xen/git/qemu-xen.git
+ TREE_XEN=osstest@xenbits.xen.org:/home/xen/git/xen.git
+ TREE_LIBVIRT=osstest@xenbits.xen.org:/home/xen/git/libvirt.git
+ TREE_RUMPRUN=osstest@xenbits.xen.org:/home/xen/git/osstest/rumprun.git
+ TREE_SEABIOS=osstest@xenbits.xen.org:/home/xen/git/osstest/seabios.git
+ TREE_OVMF=osstest@xenbits.xen.org:/home/xen/git/osstest/ovmf.git
+ TREE_XTF=osstest@xenbits.xen.org:/home/xen/git/xtf.git
+ info_linux_tree ovmf
+ case $1 in
+ return 1
+ case "$branch" in
+ cd /home/osstest/repos/ovmf
+ git push osstest@xenbits.xen.org:/home/xen/git/osstest/ovmf.git fef15ecd20dd8db5bf0c33b00908fc59491dba8a:refs/heads/xen-tested-master
To osstest@xenbits.xen.org:/home/xen/git/osstest/ovmf.git
d66f85c..fef15ec fef15ecd20dd8db5bf0c33b00908fc59491dba8a -> xen-tested-master
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply
* [PATCH 1/1 v7] ARM: imx: Added perf functionality to mmdc driver
From: Zhi Li @ 2016-11-08 20:18 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20161108201114.GQ3117@twins.programming.kicks-ass.net>
On Tue, Nov 8, 2016 at 2:11 PM, Peter Zijlstra <peterz@infradead.org> wrote:
> On Tue, Nov 08, 2016 at 01:21:47PM -0600, Zhi Li wrote:
>> On Tue, Nov 8, 2016 at 1:00 PM, Paul Gortmaker
>> > I just noticed this commit now that linux-next is back after the week off.
>> >
>> > This should probably use core_param or setup_param since the Kconfig
>> > for this is bool and not tristate.
>
>
>> I think pmu_pmu_poll_period_us should be removed because no benefit to
>> change it.
>> I can delete .remove
>
> Why not make it tristate ?
The based code provided a function, which need by suspend and resume.
best regards
Frank Li
^ permalink raw reply
* Re: [PATCH 1/1 v7] ARM: imx: Added perf functionality to mmdc driver
From: Zhi Li @ 2016-11-08 20:18 UTC (permalink / raw)
To: Peter Zijlstra
Cc: Paul Gortmaker, Frank Li, Shawn Guo,
linux-arm-kernel@lists.infradead.org, LKML, Ingo Molnar, acme,
alexander.shishkin, Mark Rutland, jerry shen, Zhengyu Shen
In-Reply-To: <20161108201114.GQ3117@twins.programming.kicks-ass.net>
On Tue, Nov 8, 2016 at 2:11 PM, Peter Zijlstra <peterz@infradead.org> wrote:
> On Tue, Nov 08, 2016 at 01:21:47PM -0600, Zhi Li wrote:
>> On Tue, Nov 8, 2016 at 1:00 PM, Paul Gortmaker
>> > I just noticed this commit now that linux-next is back after the week off.
>> >
>> > This should probably use core_param or setup_param since the Kconfig
>> > for this is bool and not tristate.
>
>
>> I think pmu_pmu_poll_period_us should be removed because no benefit to
>> change it.
>> I can delete .remove
>
> Why not make it tristate ?
The based code provided a function, which need by suspend and resume.
best regards
Frank Li
^ permalink raw reply
* Re: svc_xprt_put is no longer BH-safe
From: J. Bruce Fields @ 2016-11-08 20:20 UTC (permalink / raw)
To: Chuck Lever; +Cc: Linux NFS Mailing List
In-Reply-To: <7AB623FA-C766-4A1B-8A70-C54F4C8C80ED@oracle.com>
On Tue, Nov 08, 2016 at 03:13:13PM -0500, Chuck Lever wrote:
>
> > On Nov 8, 2016, at 3:03 PM, J. Bruce Fields <bfields@fieldses.org> wrote:
> >
> > On Sat, Oct 29, 2016 at 12:21:03PM -0400, Chuck Lever wrote:
> >> Hi Bruce-
> >
> > Sorry for the slow response!
> >
> > ...
> >> In commit 39a9beab5acb83176e8b9a4f0778749a09341f1f ('rpc: share one xps between
> >> all backchannels') you added:
> >>
> >> diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
> >> index f5572e3..4f01f63 100644
> >> --- a/net/sunrpc/svc_xprt.c
> >> +++ b/net/sunrpc/svc_xprt.c
> >> @@ -136,6 +136,8 @@ static void svc_xprt_free(struct kref *kref)
> >> /* See comment on corresponding get in xs_setup_bc_tcp(): */
> >> if (xprt->xpt_bc_xprt)
> >> xprt_put(xprt->xpt_bc_xprt);
> >> + if (xprt->xpt_bc_xps)
> >> + xprt_switch_put(xprt->xpt_bc_xps);
> >> xprt->xpt_ops->xpo_free(xprt);
> >> module_put(owner);
> >> }
> >>
> >> svc_xprt_free() is invoked by svc_xprt_put(). svc_xprt_put() is called
> >> from svc_rdma in soft IRQ context (eg. svc_rdma_wc_receive).
> >
> > Is that necessary? I wonder why the svcrdma code seems to be taking so
> > many of its own references on svc_xprts.
>
> The idea is to keep the xprt around while Work Requests (I/O) are running,
> so that the xprt is guaranteed to be there during work completions. The
> completion handlers (where svc_xprt_put is often invoked) run in soft IRQ
> context.
>
> It's simple to change completions to use a Work Queue instead, but testing
> so far shows that will result in a performance loss. I'm still studying it.
>
> Is there another way to keep the xprt's ref count boosted while I/O is
> going on?
Why do you need the svc_xprt in the completion?
Can the xpo_detach method wait for any pending completions?
--b.
>
>
> >> However, xprt_switch_put() takes a spin lock (xps_lock) which is locked
> >> everywhere without disabling BHs.
> >>
> >> It looks to me like 39a9beab5acb makes svc_xprt_put() no longer BH-safe?
> >> Not sure if svc_xprt_put() was intended to be BH-safe beforehand.
> >>
> >> Maybe xprt_switch_put() could be invoked in ->xpo_free, but that seems
> >> like a temporary solution.
> >
> > Since xpo_free is also called from svc_xprt_put that doesn't sound like
> > it would change anything. Or do we not trunk over RDMA for some reason?
>
> It's quite desirable to trunk NFS/RDMA on multiple connections, and it
> should work just like it does for TCP, but so far it's not been tested.
>
>
> --
> Chuck Lever
>
>
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.